Skip to content

Commit

Permalink
Updated the setup manager to ease module version updates and acknowle…
Browse files Browse the repository at this point in the history
…dge application structure changes

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
  • Loading branch information
gplanchat committed Jan 25, 2011
1 parent b7c0578 commit 6c455e2
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 96 deletions.
33 changes: 0 additions & 33 deletions application/code/core/One/Core/Setup/Block/StageThree.php

This file was deleted.

6 changes: 6 additions & 0 deletions application/code/core/One/Core/Setup/Block/Updates.php
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

class One_Core_Setup_Block_Updates
extends One_Core_Block_Html
{
}
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class One_Core_Setup_Model_Updater_ScriptQueue
implements Iterator, Countable, ArrayAccess 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_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_ALPHA = 'alpha';
const STAGE_BETA = 'beta'; const STAGE_BETA = 'beta';
Expand Down Expand Up @@ -41,13 +41,13 @@ public function __construct($path, $fromVersion, $toVersion)


preg_match(self::PCRE_VERSION_PATTERN, $fromVersion, $matches); preg_match(self::PCRE_VERSION_PATTERN, $fromVersion, $matches);
$fromVersion = array( $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, 'stage' => isset($matches['stage']) && !empty($matches['stage']) ? $matches['stage'] : self::STAGE_STABLE,
'level' => isset($matches['level']) && !empty($matches['level']) ? (int) $matches['level'] : 0, 'level' => isset($matches['level']) && !empty($matches['level']) ? (int) $matches['level'] : 0,
); );
preg_match(self::PCRE_VERSION_PATTERN, $toVersion, $matches); preg_match(self::PCRE_VERSION_PATTERN, $toVersion, $matches);
$toVersion = array( $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, 'stage' => isset($matches['stage']) && !empty($matches['stage']) ? $matches['stage'] : self::STAGE_STABLE,
'level' => isset($matches['level']) && !empty($matches['level']) ? (int) $matches['level'] : 0, 'level' => isset($matches['level']) && !empty($matches['level']) ? (int) $matches['level'] : 0,
); );
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -358,6 +358,34 @@ public function stageTwoSetupDatabaseAction()
} }


public function stageThreeAction() 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'); $updater = $this->app()->getModel('setup/updater');


Expand All @@ -382,15 +410,15 @@ public function stageThreeAction()
} }
} }


$this->loadLayout('setup.stage-three') $this->loadLayout('setup.updates')
->getBlock('status') ->getBlock('status')
->setModules($modules) ->setModules($modules)
; ;


$this->renderLayout(); $this->renderLayout();
} }


public function stageThreeInstallModuleAction() public function installModuleAction()
{ {
$module = $this->getRequest()->getQuery('module'); $module = $this->getRequest()->getQuery('module');


Expand All @@ -404,58 +432,14 @@ public function stageThreeInstallModuleAction()


$baseUrl = $this->getFrontController()->getBaseUrl(); $baseUrl = $this->getFrontController()->getBaseUrl();
$this->getResponse() $this->getResponse()
->setRedirect($baseUrl . '/stage-three', 302); ->setRedirect($baseUrl . '/updates', 302);
}

public function stageThreePostAction()
{
$baseUrl = $this->getFrontController()->getBaseUrl();
$this->getResponse()
->setRedirect($baseUrl . '/stage-four', 302);
} }


public function stageFourAction() public function jumpAction()
{ {
$path = dirname($_SERVER['SCRIPT_FILENAME']) . DIRECTORY_SEPARATOR;
$baseUrl = dirname($this->getFrontController()->getBaseUrl()); $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() $this->getResponse()
->setRedirect($baseUrl, 302); ->setRedirect($baseUrl, 302);
return;
} }


public function applyPatchAction() public function applyPatchAction()
Expand Down
13 changes: 4 additions & 9 deletions application/design/setup/default/base/layout/page.xml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -42,21 +42,16 @@
</block> </block>
</reference> </reference>
</setup.stage-two> </setup.stage-two>
<setup.stage-three> <setup.updates>
<reference name="head"> <reference name="head">
<action method="headTitle"> <action method="headTitle">
<params> <params>
<headTitle>Stage Three</headTitle> <headTitle>Updates Manager</headTitle>
</params> </params>
</action> </action>
</reference> </reference>
<reference name="body"> <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> </reference>
</setup.stage-three> </setup.updates>
<setup.stage-four>
<reference name="body">
<block name="scm" type="core.setup/stage-four"></block>
</reference>
</setup.stage-four>
</layout> </layout>
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
<?php elseif ($version['installed'] === $version['latest']): ?> <?php elseif ($version['installed'] === $version['latest']): ?>
<dd>Version <?php echo $this->escape($version['latest']) ?> already installed</dd> <dd>Version <?php echo $this->escape($version['latest']) ?> already installed</dd>
<?php elseif ($version['installed'] === '0.0.0'): ?> <?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: ?> <?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 endif ?>
<?php endforeach ?> <?php endforeach ?>
<?php endif ?> <?php endif ?>
</dl> </dl>
<a href="stage-four">Continue install</a> <a href="jump">Continue install</a>

0 comments on commit 6c455e2

Please sign in to comment.