@@ -14,78 +14,78 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class IndexRebuild extends \Aimeos\MW\Setup\Task\Base |
| 16 | 16 | { |
| 17 | - private static $execute = false; |
|
| 18 | - |
|
| 19 | - |
|
| 20 | - /** |
|
| 21 | - * Returns if the index should be rebuilt or not. |
|
| 22 | - * |
|
| 23 | - * @return bool |
|
| 24 | - */ |
|
| 25 | - private static function getExecute(): bool |
|
| 26 | - { |
|
| 27 | - return self::$execute; |
|
| 28 | - } |
|
| 29 | - |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * Set if the index should be rebuilt or not. |
|
| 33 | - * |
|
| 34 | - * @param bool $value |
|
| 35 | - */ |
|
| 36 | - private static function setExecute(bool $value): void |
|
| 37 | - { |
|
| 38 | - self::$execute = $value; |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * Force index rebuild. |
|
| 44 | - */ |
|
| 45 | - public static function forceExecute(): void |
|
| 46 | - { |
|
| 47 | - self::setExecute(true); |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - |
|
| 51 | - /** |
|
| 52 | - * Returns the list of task names which this task depends on. |
|
| 53 | - * |
|
| 54 | - * @return string[] List of task names |
|
| 55 | - */ |
|
| 56 | - public function getPreDependencies() |
|
| 57 | - { |
|
| 58 | - return ['TablesCreateMShop', 'MShopSetLocale']; |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * Returns the list of task names which depends on this task. |
|
| 64 | - * |
|
| 65 | - * @return array List of task names |
|
| 66 | - */ |
|
| 67 | - public function getPostDependencies() |
|
| 68 | - { |
|
| 69 | - return []; |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * Rebuilds the index if requested before via Helper\IndexRebuild. |
|
| 75 | - */ |
|
| 76 | - public function migrate() |
|
| 77 | - { |
|
| 78 | - if (self::getExecute() === true) { |
|
| 79 | - \Aimeos\MW\Common\Base::checkClass(\Aimeos\MShop\Context\Item\Iface::class, $this->additional); |
|
| 80 | - $this->msg('Rebuilding index', 0); |
|
| 81 | - |
|
| 82 | - $timestamp = date('Y-m-d H:i:s'); |
|
| 83 | - \Aimeos\MShop::create($this->additional, 'index') |
|
| 84 | - ->rebuild() |
|
| 85 | - ->cleanup($timestamp); |
|
| 86 | - self::setExecute(false); |
|
| 87 | - |
|
| 88 | - $this->status('done'); |
|
| 89 | - } |
|
| 90 | - } |
|
| 17 | + private static $execute = false; |
|
| 18 | + |
|
| 19 | + |
|
| 20 | + /** |
|
| 21 | + * Returns if the index should be rebuilt or not. |
|
| 22 | + * |
|
| 23 | + * @return bool |
|
| 24 | + */ |
|
| 25 | + private static function getExecute(): bool |
|
| 26 | + { |
|
| 27 | + return self::$execute; |
|
| 28 | + } |
|
| 29 | + |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * Set if the index should be rebuilt or not. |
|
| 33 | + * |
|
| 34 | + * @param bool $value |
|
| 35 | + */ |
|
| 36 | + private static function setExecute(bool $value): void |
|
| 37 | + { |
|
| 38 | + self::$execute = $value; |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * Force index rebuild. |
|
| 44 | + */ |
|
| 45 | + public static function forceExecute(): void |
|
| 46 | + { |
|
| 47 | + self::setExecute(true); |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + |
|
| 51 | + /** |
|
| 52 | + * Returns the list of task names which this task depends on. |
|
| 53 | + * |
|
| 54 | + * @return string[] List of task names |
|
| 55 | + */ |
|
| 56 | + public function getPreDependencies() |
|
| 57 | + { |
|
| 58 | + return ['TablesCreateMShop', 'MShopSetLocale']; |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * Returns the list of task names which depends on this task. |
|
| 64 | + * |
|
| 65 | + * @return array List of task names |
|
| 66 | + */ |
|
| 67 | + public function getPostDependencies() |
|
| 68 | + { |
|
| 69 | + return []; |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * Rebuilds the index if requested before via Helper\IndexRebuild. |
|
| 75 | + */ |
|
| 76 | + public function migrate() |
|
| 77 | + { |
|
| 78 | + if (self::getExecute() === true) { |
|
| 79 | + \Aimeos\MW\Common\Base::checkClass(\Aimeos\MShop\Context\Item\Iface::class, $this->additional); |
|
| 80 | + $this->msg('Rebuilding index', 0); |
|
| 81 | + |
|
| 82 | + $timestamp = date('Y-m-d H:i:s'); |
|
| 83 | + \Aimeos\MShop::create($this->additional, 'index') |
|
| 84 | + ->rebuild() |
|
| 85 | + ->cleanup($timestamp); |
|
| 86 | + self::setExecute(false); |
|
| 87 | + |
|
| 88 | + $this->status('done'); |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | 91 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * |
| 34 | 34 | * @param bool $value |
| 35 | 35 | */ |
| 36 | - private static function setExecute(bool $value): void |
|
| 36 | + private static function setExecute( bool $value ): void |
|
| 37 | 37 | { |
| 38 | 38 | self::$execute = $value; |
| 39 | 39 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public static function forceExecute(): void |
| 46 | 46 | { |
| 47 | - self::setExecute(true); |
|
| 47 | + self::setExecute( true ); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | |
@@ -75,17 +75,17 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function migrate() |
| 77 | 77 | { |
| 78 | - if (self::getExecute() === true) { |
|
| 79 | - \Aimeos\MW\Common\Base::checkClass(\Aimeos\MShop\Context\Item\Iface::class, $this->additional); |
|
| 80 | - $this->msg('Rebuilding index', 0); |
|
| 78 | + if( self::getExecute() === true ) { |
|
| 79 | + \Aimeos\MW\Common\Base::checkClass( \Aimeos\MShop\Context\Item\Iface::class, $this->additional ); |
|
| 80 | + $this->msg( 'Rebuilding index', 0 ); |
|
| 81 | 81 | |
| 82 | - $timestamp = date('Y-m-d H:i:s'); |
|
| 83 | - \Aimeos\MShop::create($this->additional, 'index') |
|
| 82 | + $timestamp = date( 'Y-m-d H:i:s' ); |
|
| 83 | + \Aimeos\MShop::create( $this->additional, 'index' ) |
|
| 84 | 84 | ->rebuild() |
| 85 | - ->cleanup($timestamp); |
|
| 86 | - self::setExecute(false); |
|
| 85 | + ->cleanup( $timestamp ); |
|
| 86 | + self::setExecute( false ); |
|
| 87 | 87 | |
| 88 | - $this->status('done'); |
|
| 88 | + $this->status( 'done' ); |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -14,49 +14,49 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class IndexRemoveIncompatibleTables extends \Aimeos\MW\Setup\Task\Base |
| 16 | 16 | { |
| 17 | - /** |
|
| 18 | - * Returns the list of task names which this task depends on. |
|
| 19 | - * |
|
| 20 | - * @return string[] List of task names |
|
| 21 | - */ |
|
| 22 | - public function getPreDependencies() |
|
| 23 | - { |
|
| 24 | - return []; |
|
| 25 | - } |
|
| 26 | - |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * Returns the list of task names which depends on this task. |
|
| 30 | - * |
|
| 31 | - * @return string[] List of task names |
|
| 32 | - */ |
|
| 33 | - public function getPostDependencies() |
|
| 34 | - { |
|
| 35 | - return ['TablesCreateMShop', 'IndexRebuild']; |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * Executes the task |
|
| 41 | - */ |
|
| 42 | - public function migrate() |
|
| 43 | - { |
|
| 44 | - $this->msg('Remove incompatible index tables', 0); |
|
| 45 | - $this->status(''); |
|
| 46 | - |
|
| 47 | - $schema = $this->getSchema('db-product'); |
|
| 48 | - |
|
| 49 | - $table = 'mshop_index_text'; |
|
| 50 | - $this->msg(sprintf('Checking table "%1$s"', $table), 1); |
|
| 51 | - |
|
| 52 | - if ($schema->tableExists($table) === true |
|
| 53 | - && $schema->columnExists($table, 'url') === false) { |
|
| 54 | - $this->execute('DROP TABLE "mshop_index_text"'); |
|
| 55 | - IndexRebuild::forceExecute(); |
|
| 56 | - |
|
| 57 | - $this->status('done'); |
|
| 58 | - } else { |
|
| 59 | - $this->status('OK'); |
|
| 60 | - } |
|
| 61 | - } |
|
| 17 | + /** |
|
| 18 | + * Returns the list of task names which this task depends on. |
|
| 19 | + * |
|
| 20 | + * @return string[] List of task names |
|
| 21 | + */ |
|
| 22 | + public function getPreDependencies() |
|
| 23 | + { |
|
| 24 | + return []; |
|
| 25 | + } |
|
| 26 | + |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * Returns the list of task names which depends on this task. |
|
| 30 | + * |
|
| 31 | + * @return string[] List of task names |
|
| 32 | + */ |
|
| 33 | + public function getPostDependencies() |
|
| 34 | + { |
|
| 35 | + return ['TablesCreateMShop', 'IndexRebuild']; |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * Executes the task |
|
| 41 | + */ |
|
| 42 | + public function migrate() |
|
| 43 | + { |
|
| 44 | + $this->msg('Remove incompatible index tables', 0); |
|
| 45 | + $this->status(''); |
|
| 46 | + |
|
| 47 | + $schema = $this->getSchema('db-product'); |
|
| 48 | + |
|
| 49 | + $table = 'mshop_index_text'; |
|
| 50 | + $this->msg(sprintf('Checking table "%1$s"', $table), 1); |
|
| 51 | + |
|
| 52 | + if ($schema->tableExists($table) === true |
|
| 53 | + && $schema->columnExists($table, 'url') === false) { |
|
| 54 | + $this->execute('DROP TABLE "mshop_index_text"'); |
|
| 55 | + IndexRebuild::forceExecute(); |
|
| 56 | + |
|
| 57 | + $this->status('done'); |
|
| 58 | + } else { |
|
| 59 | + $this->status('OK'); |
|
| 60 | + } |
|
| 61 | + } |
|
| 62 | 62 | } |
@@ -41,22 +41,22 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | public function migrate() |
| 43 | 43 | { |
| 44 | - $this->msg('Remove incompatible index tables', 0); |
|
| 45 | - $this->status(''); |
|
| 44 | + $this->msg( 'Remove incompatible index tables', 0 ); |
|
| 45 | + $this->status( '' ); |
|
| 46 | 46 | |
| 47 | - $schema = $this->getSchema('db-product'); |
|
| 47 | + $schema = $this->getSchema( 'db-product' ); |
|
| 48 | 48 | |
| 49 | 49 | $table = 'mshop_index_text'; |
| 50 | - $this->msg(sprintf('Checking table "%1$s"', $table), 1); |
|
| 50 | + $this->msg( sprintf( 'Checking table "%1$s"', $table ), 1 ); |
|
| 51 | 51 | |
| 52 | - if ($schema->tableExists($table) === true |
|
| 53 | - && $schema->columnExists($table, 'url') === false) { |
|
| 54 | - $this->execute('DROP TABLE "mshop_index_text"'); |
|
| 52 | + if( $schema->tableExists( $table ) === true |
|
| 53 | + && $schema->columnExists( $table, 'url' ) === false ) { |
|
| 54 | + $this->execute( 'DROP TABLE "mshop_index_text"' ); |
|
| 55 | 55 | IndexRebuild::forceExecute(); |
| 56 | 56 | |
| 57 | - $this->status('done'); |
|
| 57 | + $this->status( 'done' ); |
|
| 58 | 58 | } else { |
| 59 | - $this->status('OK'); |
|
| 59 | + $this->status( 'OK' ); |
|
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | } |