Permalink
Browse files

Updated the setup manager to ease module version updates and acknowle…

…dge application structure changes

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
  • Loading branch information...
1 parent b7c0578 commit 6c455e24f851e55de113436f8ed121b3442574b9 @gplanchat committed Jan 25, 2011
View
33 application/code/core/One/Core/Setup/Block/StageThree.php
@@ -1,33 +0,0 @@
-<?php
-
-class One_Core_Setup_Block_StageThree
- extends One_Core_Block_Html
-{
-// public function _construct($options)
-// {
-// parent::_construct($options);
-//
-// $script =<<<SCRIPT_EOF
-//$(document).ready(function(){
-// $('.rdbms.test').click(function(e){
-// e.preventDefault();
-//
-// var result = $.post('stage-two-rdbms-test-ajax', $(':input', $(this).parents('fieldset').first()).serializeArray(), function(response, status, request) {
-// if (status !== 'success') {
-// return;
-// }
-// if (response.status === true) {
-// alert('Connection was successful, using server version "' + response.version + '".');
-// } else {
-// alert('Connection failed, the server returned the following error: "' + response.error + '".');
-// }
-// }, 'json');
-// });
-// });
-//SCRIPT_EOF;
-//
-// $this->headScript()
-// ->appendScript(file_get_contents(ROOT_PATH . DS . 'public/js/jquery.js'))
-// ->appendScript($script);
-// }
-}
View
6 application/code/core/One/Core/Setup/Block/Updates.php
@@ -0,0 +1,6 @@
+<?php
+
+class One_Core_Setup_Block_Updates
+ extends One_Core_Block_Html
+{
+}
View
6 application/code/core/One/Core/Setup/Model/Updater/ScriptQueue.php
@@ -4,7 +4,7 @@ class One_Core_Setup_Model_Updater_ScriptQueue
implements Iterator, Countable, ArrayAccess
{
const PCRE_FILE_PATTERN = '%^(?<action>install|upgrade|uninstall|downgrade)-(?<version1>[0-9]+\.[0-9]+\.[0-9]+)(?:\.(?<stage1>[a-z]+)(?<level1>[0-9]+))?(?:-(?<version2>[0-9]+\.[0-9]+\.[0-9]+)(?:\.(?<stage2>[a-z]+)(?<level2>[0-9]+))?)?$%';
- const PCRE_VERSION_PATTERN = '%^(?<version>[0-9]+\.[0-9]+\.[0-9]+)(?:-(?<stage>[a-z]+)(?<level>[0-9]+))?$%';
+ const PCRE_VERSION_PATTERN = '%^(?<version>[0-9]+\.[0-9]+\.[0-9]+)(?:-(?<stage>[a-z]+)(?<level>[0-9]+)?)?$%';
const STAGE_ALPHA = 'alpha';
const STAGE_BETA = 'beta';
@@ -41,13 +41,13 @@ public function __construct($path, $fromVersion, $toVersion)
preg_match(self::PCRE_VERSION_PATTERN, $fromVersion, $matches);
$fromVersion = array(
- 'version' => $matches['version'],
+ 'version' => isset($matches['version']) ? $matches['version'] : self::VERSION_NULL,
'stage' => isset($matches['stage']) && !empty($matches['stage']) ? $matches['stage'] : self::STAGE_STABLE,
'level' => isset($matches['level']) && !empty($matches['level']) ? (int) $matches['level'] : 0,
);
preg_match(self::PCRE_VERSION_PATTERN, $toVersion, $matches);
$toVersion = array(
- 'version' => $matches['version'],
+ 'version' => isset($matches['version']) ? $matches['version'] : self::VERSION_NULL,
'stage' => isset($matches['stage']) && !empty($matches['stage']) ? $matches['stage'] : self::STAGE_STABLE,
'level' => isset($matches['level']) && !empty($matches['level']) ? (int) $matches['level'] : 0,
);
View
80 application/code/core/One/Core/Setup/controllers/IndexController.php
@@ -359,6 +359,34 @@ public function stageTwoSetupDatabaseAction()
public function stageThreeAction()
{
+ $path = dirname($_SERVER['SCRIPT_FILENAME']) . DIRECTORY_SEPARATOR;
+ $baseUrl = dirname($this->getFrontController()->getBaseUrl());
+
+ $htaccess =<<<HTACCESS_EOF
+RewriteEngine On
+
+RewriteBase {$baseUrl}/
+
+RewriteCond %{REQUEST_FILENAME} -l [OR]
+RewriteCond %{REQUEST_FILENAME} -s [OR]
+RewriteCond %{REQUEST_FILENAME} -d
+RewriteRule . - [L,NC]
+
+RewriteRule . index.php [L,NC]
+
+SetEnv APPLICATION_ENV production
+HTACCESS_EOF;
+ file_put_contents($path . '.htaccess', $htaccess);
+ copy($path . 'index.php.sample', $path . 'index.php');
+
+ $baseUrl = $this->getFrontController()->getBaseUrl();
+ $this->getResponse()
+ ->setRedirect($baseUrl . '/updates', 302);
+ return;
+ }
+
+ public function updatesAction()
+ {
$updater = $this->app()->getModel('setup/updater');
$modules = array();
@@ -382,15 +410,15 @@ public function stageThreeAction()
}
}
- $this->loadLayout('setup.stage-three')
+ $this->loadLayout('setup.updates')
->getBlock('status')
->setModules($modules)
;
$this->renderLayout();
}
- public function stageThreeInstallModuleAction()
+ public function installModuleAction()
{
$module = $this->getRequest()->getQuery('module');
@@ -404,58 +432,14 @@ public function stageThreeInstallModuleAction()
$baseUrl = $this->getFrontController()->getBaseUrl();
$this->getResponse()
- ->setRedirect($baseUrl . '/stage-three', 302);
- }
-
- public function stageThreePostAction()
- {
- $baseUrl = $this->getFrontController()->getBaseUrl();
- $this->getResponse()
- ->setRedirect($baseUrl . '/stage-four', 302);
+ ->setRedirect($baseUrl . '/updates', 302);
}
- public function stageFourAction()
+ public function jumpAction()
{
- $path = dirname($_SERVER['SCRIPT_FILENAME']) . DIRECTORY_SEPARATOR;
$baseUrl = dirname($this->getFrontController()->getBaseUrl());
-
- $htaccess =<<<HTACCESS_EOF
-RewriteEngine On
-
-RewriteBase {$baseUrl}/
-
-RewriteCond %{REQUEST_FILENAME} -l [OR]
-RewriteCond %{REQUEST_FILENAME} -s [OR]
-RewriteCond %{REQUEST_FILENAME} -d
-RewriteRule . - [L,NC]
-
-RewriteRule . index.php [L,NC]
-
-SetEnv APPLICATION_ENV production
-HTACCESS_EOF;
- file_put_contents($path . '.htaccess', $htaccess);
- copy($path . 'index.php.sample', $path . 'index.php');
-
- $htaccess =<<<HTACCESS_EOF
-RewriteEngine On
-
-RewriteBase {$baseUrl}/admin/
-
-RewriteCond %{REQUEST_FILENAME} -l [OR]
-RewriteCond %{REQUEST_FILENAME} -s [OR]
-RewriteCond %{REQUEST_FILENAME} -d
-RewriteRule . - [L,NC]
-
-RewriteRule . index.php [L,NC]
-
-SetEnv APPLICATION_ENV production
-HTACCESS_EOF;
- file_put_contents($path . 'admin' . DIRECTORY_SEPARATOR . '.htaccess', $htaccess);
- copy($path . 'admin' . DIRECTORY_SEPARATOR . 'index.php.sample', $path . 'admin' . DIRECTORY_SEPARATOR . 'index.php');
-
$this->getResponse()
->setRedirect($baseUrl, 302);
- return;
}
public function applyPatchAction()
View
13 application/design/setup/default/base/layout/page.xml
@@ -42,21 +42,16 @@
</block>
</reference>
</setup.stage-two>
- <setup.stage-three>
+ <setup.updates>
<reference name="head">
<action method="headTitle">
<params>
- <headTitle>Stage Three</headTitle>
+ <headTitle>Updates Manager</headTitle>
</params>
</action>
</reference>
<reference name="body">
- <block name="status" type="core.setup/stage-three" template="stage-three.phtml"></block>
+ <block name="status" type="core.setup/updates" template="updates.phtml"></block>
</reference>
- </setup.stage-three>
- <setup.stage-four>
- <reference name="body">
- <block name="scm" type="core.setup/stage-four"></block>
- </reference>
- </setup.stage-four>
+ </setup.updates>
</layout>
View
6 ...efault/default/template/stage-three.phtml → ...up/default/default/template/updates.phtml
@@ -10,11 +10,11 @@
<?php elseif ($version['installed'] === $version['latest']): ?>
<dd>Version <?php echo $this->escape($version['latest']) ?> already installed</dd>
<?php elseif ($version['installed'] === '0.0.0'): ?>
- <dd><a href="stage-three-install-module?module=<?php echo $this->escape($module) ?>">Install version <?php echo $this->escape($version['latest']) ?></a></dd>
+ <dd><a href="install-module?module=<?php echo $this->escape($module) ?>">Install version <?php echo $this->escape($version['latest']) ?></a></dd>
<?php else: ?>
- <dd><a href="stage-three-install-module?module=<?php echo $this->escape($module) ?>">Upgrade to version <?php echo $this->escape($version['latest']) ?></a> (currently using version <?php echo $this->escape($version['installed']) ?>)</dd>
+ <dd><a href="install-module?module=<?php echo $this->escape($module) ?>">Upgrade to version <?php echo $this->escape($version['latest']) ?></a> (currently using version <?php echo $this->escape($version['installed']) ?>)</dd>
<?php endif ?>
<?php endforeach ?>
<?php endif ?>
</dl>
-<a href="stage-four">Continue install</a>
+<a href="jump">Continue install</a>

0 comments on commit 6c455e2

Please sign in to comment.