Changeset 3730078
- Timestamp:
- 10/06/2026 05:56:00 AM (3 weeks ago)
- Location:
- template-oriented-form-utilities
- Files:
-
- 12 edited
- 1 copied
-
tags/0.1.3 (copied) (copied from template-oriented-form-utilities/trunk )
-
tags/0.1.3/readme.txt (modified) (2 diffs)
-
tags/0.1.3/src/Init/Migrate.php (modified) (5 diffs)
-
tags/0.1.3/template-oriented-form-utilities.php (modified) (4 diffs)
-
tags/0.1.3/vendor/autoload.php (modified) (1 diff)
-
tags/0.1.3/vendor/composer/autoload_real.php (modified) (2 diffs)
-
tags/0.1.3/vendor/composer/autoload_static.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/src/Init/Migrate.php (modified) (5 diffs)
-
trunk/template-oriented-form-utilities.php (modified) (4 diffs)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_real.php (modified) (2 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
template-oriented-form-utilities/tags/0.1.3/readme.txt
r3723117 r3730078 2 2 Contributors: lionheartgroup 3 3 Tags: forms, utilities, template-oriented 4 Requires at least: 6. 04 Requires at least: 6.5 5 5 Tested up to: 7.1 6 6 Requires PHP: 8.1 7 Stable tag: 0.1. 27 Stable tag: 0.1.3 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.txt … … 164 164 - Declared `Requires at least: 6.0`, so translate.wordpress.org imports the plugin's strings. 165 165 - Escaped and sanitized request values flagged by Plugin Check. 166 * v0.1.3 167 - Fixed: database migrations now also run when the plugin's files are replaced without 168 WordPress's updater (FTP, deployments). The plugin compares the stored `tofu_db_version` 169 with its own version on `init` and runs any outstanding migration once; a failed one is 170 retried on the next request. 171 - Requires WordPress 6.5. 166 172 167 173 -
template-oriented-form-utilities/tags/0.1.3/src/Init/Migrate.php
r3723117 r3730078 12 12 */ 13 13 const TABLE_SUFFIX = 'tofu_migrate'; 14 15 /** 16 * Option holding the plugin version whose migrations have all run. 17 */ 18 const VERSION_OPTION = 'tofu_db_version'; 14 19 15 20 /** … … 74 79 75 80 /** 81 * Run the migrations once per plugin version, on any request. 82 * 83 * Activation and `upgrader_process_complete` miss updates made by 84 * replacing the plugin's files (FTP, deployments), so `init` compares the 85 * stored version first — one autoloaded option, no query when it matches. 86 * It runs on the front end too: a form saving a record must not meet a 87 * table without the columns it writes. Migrations are idempotent, so two 88 * requests running them at once do no harm. 89 * 90 * @param string $version The plugin's version (TOFU_VERSION). 91 * @param ?callable(): bool $runner Runs the migrations; migrate() by default. 92 * @return bool Whether the migrations ran. 93 */ 94 public static function maybeMigrate(string $version, ?callable $runner = null): bool 95 { 96 if (!static::needsMigration(get_option(static::VERSION_OPTION), $version)) { 97 return false; 98 } 99 100 $runner ??= [static::class, 'migrate']; 101 if ($runner() === true) { 102 update_option(static::VERSION_OPTION, $version, true); 103 } 104 105 return true; 106 } 107 108 /** 109 * Whether the stored version calls for running the migrations. 110 * 111 * @param mixed $stored get_option() result (false when missing). 112 * @param string $version 113 * @return bool 114 */ 115 public static function needsMigration(mixed $stored, string $version): bool 116 { 117 return $stored !== $version; 118 } 119 120 /** 76 121 * Execute migrations 77 122 * 78 * @return void79 */ 80 public static function migrate(): void123 * @return bool True when every migration has been applied (now or before). 124 */ 125 public static function migrate(): bool 81 126 { 82 127 global $wpdb; 83 128 static::checkMigrateTable(); 129 $complete = true; 84 130 85 131 foreach ([ … … 99 145 if ($migrateClass === null) { 100 146 Logger::error("Migration {$migrate} does not return a Migration object."); 147 $complete = false; 101 148 continue; 102 149 } … … 108 155 if ($result === false) { 109 156 Logger::error("Migration {$migrate} raw query failed: " . $wpdb->last_error); 157 $complete = false; 110 158 continue; 111 159 } … … 125 173 ]); 126 174 } 175 176 return $complete; 127 177 } 128 178 -
template-oriented-form-utilities/tags/0.1.3/template-oriented-form-utilities.php
r3723117 r3730078 11 11 * Plugin URI: https://github.com/lionheart-group/wp-template-oriented-plugins/tree/master/plugins/template-oriented-form-utilities 12 12 * Description: Template-Oriented Form Utilities is a WordPress plugin that provides a set of utilities for handling forms in a template-oriented manner. 13 * Version: 0.1. 213 * Version: 0.1.3 14 14 * Author: lionheartgroup 15 15 * Author URI: https://www.lionheart.co.jp/ 16 16 * Text Domain: template-oriented-form-utilities 17 17 * Domain Path: /languages 18 * Requires at least: 6. 018 * Requires at least: 6.5 19 19 * Requires PHP: 8.1 20 20 * License: GPL-3.0+ … … 30 30 * Rename this for your plugin and update it as you release new versions. 31 31 */ 32 define('TOFU_VERSION', '0.1. 2');32 define('TOFU_VERSION', '0.1.3'); 33 33 define('TOFU_PLUGIN_DIR', plugin_dir_path(__FILE__)); 34 34 define('TOFU_PLUGIN_FILE', __FILE__); … … 43 43 use TofuPlugin\Init\FormsPage; 44 44 use TofuPlugin\Init\Initializer; 45 use TofuPlugin\Init\Migrate; 45 46 use TofuPlugin\Init\Endpoint; 46 47 use TofuPlugin\Init\RestEndpoint; … … 75 76 Initializer::deactivate(); 76 77 }); 78 79 // Run migrations not yet applied for this version, whatever way the files were 80 // updated (the hooks below miss FTP uploads and deployments). 81 add_action('init', function () { 82 Migrate::maybeMigrate(TOFU_VERSION); 83 }, 0); 77 84 78 85 // Register hooks that are fired when the plugin is upgraded. -
template-oriented-form-utilities/tags/0.1.3/vendor/autoload.php
r3723117 r3730078 20 20 require_once __DIR__ . '/composer/autoload_real.php'; 21 21 22 return ComposerAutoloaderInit 08837cd0811da7fc7d20fb8e1a718df2::getLoader();22 return ComposerAutoloaderInitb966618717ad8d72bb2f45653c8b67f1::getLoader(); -
template-oriented-form-utilities/tags/0.1.3/vendor/composer/autoload_real.php
r3723117 r3730078 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 08837cd0811da7fc7d20fb8e1a718df25 class ComposerAutoloaderInitb966618717ad8d72bb2f45653c8b67f1 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 08837cd0811da7fc7d20fb8e1a718df2', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInitb966618717ad8d72bb2f45653c8b67f1', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 08837cd0811da7fc7d20fb8e1a718df2', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInitb966618717ad8d72bb2f45653c8b67f1', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit 08837cd0811da7fc7d20fb8e1a718df2::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInitb966618717ad8d72bb2f45653c8b67f1::getInitializer($loader)); 33 33 34 34 $loader->setClassMapAuthoritative(true); -
template-oriented-form-utilities/tags/0.1.3/vendor/composer/autoload_static.php
r3723117 r3730078 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 08837cd0811da7fc7d20fb8e1a718df27 class ComposerStaticInitb966618717ad8d72bb2f45653c8b67f1 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 157 157 { 158 158 return \Closure::bind(function () use ($loader) { 159 $loader->prefixLengthsPsr4 = ComposerStaticInit 08837cd0811da7fc7d20fb8e1a718df2::$prefixLengthsPsr4;160 $loader->prefixDirsPsr4 = ComposerStaticInit 08837cd0811da7fc7d20fb8e1a718df2::$prefixDirsPsr4;161 $loader->classMap = ComposerStaticInit 08837cd0811da7fc7d20fb8e1a718df2::$classMap;159 $loader->prefixLengthsPsr4 = ComposerStaticInitb966618717ad8d72bb2f45653c8b67f1::$prefixLengthsPsr4; 160 $loader->prefixDirsPsr4 = ComposerStaticInitb966618717ad8d72bb2f45653c8b67f1::$prefixDirsPsr4; 161 $loader->classMap = ComposerStaticInitb966618717ad8d72bb2f45653c8b67f1::$classMap; 162 162 163 163 }, null, ClassLoader::class); -
template-oriented-form-utilities/trunk/readme.txt
r3723117 r3730078 2 2 Contributors: lionheartgroup 3 3 Tags: forms, utilities, template-oriented 4 Requires at least: 6. 04 Requires at least: 6.5 5 5 Tested up to: 7.1 6 6 Requires PHP: 8.1 7 Stable tag: 0.1. 27 Stable tag: 0.1.3 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.txt … … 164 164 - Declared `Requires at least: 6.0`, so translate.wordpress.org imports the plugin's strings. 165 165 - Escaped and sanitized request values flagged by Plugin Check. 166 * v0.1.3 167 - Fixed: database migrations now also run when the plugin's files are replaced without 168 WordPress's updater (FTP, deployments). The plugin compares the stored `tofu_db_version` 169 with its own version on `init` and runs any outstanding migration once; a failed one is 170 retried on the next request. 171 - Requires WordPress 6.5. 166 172 167 173 -
template-oriented-form-utilities/trunk/src/Init/Migrate.php
r3723117 r3730078 12 12 */ 13 13 const TABLE_SUFFIX = 'tofu_migrate'; 14 15 /** 16 * Option holding the plugin version whose migrations have all run. 17 */ 18 const VERSION_OPTION = 'tofu_db_version'; 14 19 15 20 /** … … 74 79 75 80 /** 81 * Run the migrations once per plugin version, on any request. 82 * 83 * Activation and `upgrader_process_complete` miss updates made by 84 * replacing the plugin's files (FTP, deployments), so `init` compares the 85 * stored version first — one autoloaded option, no query when it matches. 86 * It runs on the front end too: a form saving a record must not meet a 87 * table without the columns it writes. Migrations are idempotent, so two 88 * requests running them at once do no harm. 89 * 90 * @param string $version The plugin's version (TOFU_VERSION). 91 * @param ?callable(): bool $runner Runs the migrations; migrate() by default. 92 * @return bool Whether the migrations ran. 93 */ 94 public static function maybeMigrate(string $version, ?callable $runner = null): bool 95 { 96 if (!static::needsMigration(get_option(static::VERSION_OPTION), $version)) { 97 return false; 98 } 99 100 $runner ??= [static::class, 'migrate']; 101 if ($runner() === true) { 102 update_option(static::VERSION_OPTION, $version, true); 103 } 104 105 return true; 106 } 107 108 /** 109 * Whether the stored version calls for running the migrations. 110 * 111 * @param mixed $stored get_option() result (false when missing). 112 * @param string $version 113 * @return bool 114 */ 115 public static function needsMigration(mixed $stored, string $version): bool 116 { 117 return $stored !== $version; 118 } 119 120 /** 76 121 * Execute migrations 77 122 * 78 * @return void79 */ 80 public static function migrate(): void123 * @return bool True when every migration has been applied (now or before). 124 */ 125 public static function migrate(): bool 81 126 { 82 127 global $wpdb; 83 128 static::checkMigrateTable(); 129 $complete = true; 84 130 85 131 foreach ([ … … 99 145 if ($migrateClass === null) { 100 146 Logger::error("Migration {$migrate} does not return a Migration object."); 147 $complete = false; 101 148 continue; 102 149 } … … 108 155 if ($result === false) { 109 156 Logger::error("Migration {$migrate} raw query failed: " . $wpdb->last_error); 157 $complete = false; 110 158 continue; 111 159 } … … 125 173 ]); 126 174 } 175 176 return $complete; 127 177 } 128 178 -
template-oriented-form-utilities/trunk/template-oriented-form-utilities.php
r3723117 r3730078 11 11 * Plugin URI: https://github.com/lionheart-group/wp-template-oriented-plugins/tree/master/plugins/template-oriented-form-utilities 12 12 * Description: Template-Oriented Form Utilities is a WordPress plugin that provides a set of utilities for handling forms in a template-oriented manner. 13 * Version: 0.1. 213 * Version: 0.1.3 14 14 * Author: lionheartgroup 15 15 * Author URI: https://www.lionheart.co.jp/ 16 16 * Text Domain: template-oriented-form-utilities 17 17 * Domain Path: /languages 18 * Requires at least: 6. 018 * Requires at least: 6.5 19 19 * Requires PHP: 8.1 20 20 * License: GPL-3.0+ … … 30 30 * Rename this for your plugin and update it as you release new versions. 31 31 */ 32 define('TOFU_VERSION', '0.1. 2');32 define('TOFU_VERSION', '0.1.3'); 33 33 define('TOFU_PLUGIN_DIR', plugin_dir_path(__FILE__)); 34 34 define('TOFU_PLUGIN_FILE', __FILE__); … … 43 43 use TofuPlugin\Init\FormsPage; 44 44 use TofuPlugin\Init\Initializer; 45 use TofuPlugin\Init\Migrate; 45 46 use TofuPlugin\Init\Endpoint; 46 47 use TofuPlugin\Init\RestEndpoint; … … 75 76 Initializer::deactivate(); 76 77 }); 78 79 // Run migrations not yet applied for this version, whatever way the files were 80 // updated (the hooks below miss FTP uploads and deployments). 81 add_action('init', function () { 82 Migrate::maybeMigrate(TOFU_VERSION); 83 }, 0); 77 84 78 85 // Register hooks that are fired when the plugin is upgraded. -
template-oriented-form-utilities/trunk/vendor/autoload.php
r3723117 r3730078 20 20 require_once __DIR__ . '/composer/autoload_real.php'; 21 21 22 return ComposerAutoloaderInit 08837cd0811da7fc7d20fb8e1a718df2::getLoader();22 return ComposerAutoloaderInitb966618717ad8d72bb2f45653c8b67f1::getLoader(); -
template-oriented-form-utilities/trunk/vendor/composer/autoload_real.php
r3723117 r3730078 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 08837cd0811da7fc7d20fb8e1a718df25 class ComposerAutoloaderInitb966618717ad8d72bb2f45653c8b67f1 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 08837cd0811da7fc7d20fb8e1a718df2', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInitb966618717ad8d72bb2f45653c8b67f1', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 08837cd0811da7fc7d20fb8e1a718df2', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInitb966618717ad8d72bb2f45653c8b67f1', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit 08837cd0811da7fc7d20fb8e1a718df2::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInitb966618717ad8d72bb2f45653c8b67f1::getInitializer($loader)); 33 33 34 34 $loader->setClassMapAuthoritative(true); -
template-oriented-form-utilities/trunk/vendor/composer/autoload_static.php
r3723117 r3730078 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 08837cd0811da7fc7d20fb8e1a718df27 class ComposerStaticInitb966618717ad8d72bb2f45653c8b67f1 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 157 157 { 158 158 return \Closure::bind(function () use ($loader) { 159 $loader->prefixLengthsPsr4 = ComposerStaticInit 08837cd0811da7fc7d20fb8e1a718df2::$prefixLengthsPsr4;160 $loader->prefixDirsPsr4 = ComposerStaticInit 08837cd0811da7fc7d20fb8e1a718df2::$prefixDirsPsr4;161 $loader->classMap = ComposerStaticInit 08837cd0811da7fc7d20fb8e1a718df2::$classMap;159 $loader->prefixLengthsPsr4 = ComposerStaticInitb966618717ad8d72bb2f45653c8b67f1::$prefixLengthsPsr4; 160 $loader->prefixDirsPsr4 = ComposerStaticInitb966618717ad8d72bb2f45653c8b67f1::$prefixDirsPsr4; 161 $loader->classMap = ComposerStaticInitb966618717ad8d72bb2f45653c8b67f1::$classMap; 162 162 163 163 }, null, ClassLoader::class);
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)