* DISCLAIMER
 *
 * This file is a part of a framework. Please, do not modify it unless you discard
 * further updates.
 *
 * @version 1.0
 * @author Roman Ganin
 * @copyright Copyright (c) 2012-2015 rganin (rganin@gmail.com)
 * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
 */
$options = getopt("p:a:");
if (!isset($options['p'])) {
    echo 'Usage:' . PHP_EOL;
    echo 'php -f prepare_translations.php -- -p path/to/executed_scripts.json -a path/to/app/root';
    die;
}
require '../../core.php';
\Magelight\App::getForgery()->setPreference(\Magelight\App::class, \Magelight\App\Web::class);
\Magelight\App::getInstance()->addModulesDir(realpath($options['a']) . DS . 'modules')->setAppDir($options['a'])->setDeveloperMode(true)->init();
$jsonFile = realpath($options['p']);
$scripts = json_decode(file_get_contents($jsonFile), true);
$data = [];
foreach ($scripts as $moduleName => $executedModuleScripts) {
    foreach ($executedModuleScripts as $scriptName => $scriptData) {
        $data[] = ['module_name' => $moduleName, 'script_name' => $scriptName];
    }
}
$installer = \Magelight\Installer::forge();
foreach ($data as $update) {
    $installer->setSetupScriptExecuted($update['module_name'], $update['script_name']);
}
Esempio n. 2
0
 public function testSetSetupScriptExecuted()
 {
     $this->appMock->expects($this->any())->method('db')->will($this->returnValue($this->dbMock));
     $this->dbMock->expects($this->at(0))->method('execute')->with($this->matchesRegularExpression('/CREATE TABLE.*/'));
     $installer = \Magelight\Installer::forge();
     $this->dbMock->expects($this->at(0))->method('execute')->with($this->matches("INSERT INTO `" . $installer->getVersionTable() . "` (module_name, setup_script) VALUES (?, ?)"), ['Module1', 'setup-1.0.0.0.php']);
     $this->assertInstanceOf(\Magelight\Installer::class, $installer->setSetupScriptExecuted('Module1', 'setup-1.0.0.0.php'));
 }
Esempio n. 3
0
<?php

/**
 * Magelight
 *
 * NOTICE OF LICENSE
 *
 * This file is open source and it`s distribution is based on
 * Open Software License (OSL 3.0). You can obtain license text at
 * http://opensource.org/licenses/osl-3.0.php
 *
 * For any non license implied issues please contact rganin@gmail.com
 *
 * @version 1.0
 * @author Roman Ganin
 * @copyright Copyright (c) 2012-2015 rganin (rganin@gmail.com)
 * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
 */
require __DIR__ . '/../core.php';
\Magelight\App::getForgery()->setPreference(\Magelight\App::class, \Magelight\App\Web::class);
\Magelight\App::getInstance()->addModulesDir(__DIR__ . DS . 'modules')->setAppDir(__DIR__)->setDeveloperMode(true)->init()->flushAllCache();
\Magelight\Installer::forge()->upgrade();