Changeset 2213289
- Timestamp:
- 12/16/2019 11:24:56 PM (6 years ago)
- Location:
- wpdevhub-dlm/trunk/classes
- Files:
-
- 2 edited
-
class.DSCF_DLM_Utilities.php (modified) (1 diff)
-
core/class.DSCF_DLM_StandardMain.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wpdevhub-dlm/trunk/classes/class.DSCF_DLM_Utilities.php
r1981731 r2213289 30 30 * @static 31 31 * @param $currentVersion 32 * @param $ installCallback33 */ 34 public static function checkForUpgrade($currentVersion, $ installCallback){32 * @param $upgradeCallback 33 */ 34 public static function checkForUpgrade($currentVersion, $upgradeCallback){ 35 35 global $wpdb; 36 36 $installedVersion = DSCF_DLM_Utilities::getInstalledVersionNumber(); 37 37 if ( $currentVersion != $installedVersion) { 38 // Upgrade the Database39 call_user_func($ installCallback);38 // Run items in the upgrade callback (should be "upgradePlugin") 39 call_user_func($upgradeCallback); 40 40 41 41 // Update the version number in the Options Database -
wpdevhub-dlm/trunk/classes/core/class.DSCF_DLM_StandardMain.php
r1981731 r2213289 82 82 register_deactivation_hook(__FILE__, array(static::$classname, 'wpActionDeactivate')); 83 83 84 // Check for a Database Upgrade 85 if(static::SWITCH_USE_DATABASE){ 86 DSCF_DLM_Utilities::checkForUpgrade(static::CURRENT_VERSION, array(static::$classname,'installDatabase')); 87 } 84 // Check for a Plugin Upgrade 85 DSCF_DLM_Utilities::checkForUpgrade(static::CURRENT_VERSION, array(static::$classname,'upgradePlugin')); 88 86 89 87 // Register the settings … … 390 388 $object = new $classname(); 391 389 392 add_filter( 'the_content', array($classname, 'wpFilterTheContent') );393 add_filter( 'the_excerpt', array($classname, 'wpFilterTheExcerpt') );394 add_filter( 'get_the_excerpt', array($classname, 'wpFilterTheExcerpt') );390 add_filter( 'the_content', array($classname, 'wpFilterTheContent'), 9); // Put before 10 so that we grab content before applying filters 391 add_filter( 'the_excerpt', array($classname, 'wpFilterTheExcerpt'), 9); 392 add_filter( 'get_the_excerpt', array($classname, 'wpFilterTheExcerpt'), 9); 395 393 add_filter( 'get_the_archive_title', array($classname, 'wpFilterGetTheArchiveTitle')); 396 394 … … 419 417 } 420 418 419 /* 420 * Migrates the plugin from one version to another. Is triggered by the CURRENT_VERSION being different 421 */ 422 public static function upgradePlugin(){ 423 424 // First call the install database routine and update the scheme as needed 425 call_user_func(array(static::$classname, 'installDatabase')); 426 427 // get the current installed version 428 $oldVersion = DSCF_DLM_Utilities::getInstalledVersionNumber(); 429 430 // Now loop through and migrate the plugin one by one. That way if installed version is 2 and new version is 5, this will be called 3 times. 431 for($i = $oldVersion; $i <= static::CURRENT_VERSION; $i++){ 432 static::migratePluginVersions($i); 433 } 434 435 } 436 437 // Child plugins will implement this to indicate routines that need to be executed when migrating off an old plugin version 438 public static function migratePluginVersions($oldVersion){} 439 421 440 }
Note: See TracChangeset
for help on using the changeset viewer.