Index: branches/5.3.x/core/install/upgrades.php =================================================================== diff -u -N -r16324 -r16395 --- branches/5.3.x/core/install/upgrades.php (.../upgrades.php) (revision 16324) +++ branches/5.3.x/core/install/upgrades.php (.../upgrades.php) (revision 16395) @@ -1,6 +1,6 @@ getTableName(); $fields = $this->Conn->Query('DESCRIBE ' . $table_name, 'Field'); + // The "_renameTables" method doesn't rename IDField, so find real one in DESCRIBE result. + if ( !isset($fields[$id_field]) ) { + $id_field = 'EventId'; + } + if ( !isset($fields['l1_Body']) ) { // column dropped - nothing to convert anymore return; @@ -2352,6 +2357,45 @@ } /** + * Update to 5.2.2-B1 + * + * @param string $mode when called mode {before, after) + */ + public function Upgrade_5_2_2_B1($mode) + { + if ( $mode != 'after' ) { + return; + } + + $this->deleteThumbnails(); + } + + /** + * Deletes folders, containing thumbnails recursively. + * + * @param string $folder Folder. + * + * @return void + */ + protected function deleteThumbnails($folder = WRITEABLE) + { + foreach ( glob($folder . '/*', GLOB_ONLYDIR) as $sub_folder ) { + if ( $sub_folder === WRITEABLE . '/cache' ) { + continue; + } + + if ( basename($sub_folder) === 'resized' ) { + $files = glob($sub_folder . '/*'); + array_map('unlink', $files); + rmdir($sub_folder); + } + else { + $this->deleteThumbnails($sub_folder); + } + } + } + + /** * Update to 5.3.0-B1 * * @param string $mode when called mode {before, after)