Skip to content
This repository has been archived by the owner on Jan 2, 2020. It is now read-only.

Commit

Permalink
Correctly move the Contao files to their destination in the installer…
Browse files Browse the repository at this point in the history
… (see #39)
  • Loading branch information
leofeyer committed Dec 20, 2012
1 parent 25b286e commit 63e7722
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 17 deletions.
3 changes: 2 additions & 1 deletion check/controller/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ public function initialize()

session_start();

define('CONTAO_CHECK_VERSION', '5.1');
define('CONTAO_CHECK_VERSION', '5.2');
define('IS_WINDOWS', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'));
define('TL_ROOT', dirname(dirname(dirname(__FILE__))));

$this->setLocale($this->getLanguage());
}
Expand Down
14 changes: 7 additions & 7 deletions check/controller/installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,9 @@ public function requiresFtp()
public function hasInstallation()
{
if ($this->existing === null) {
if (file_exists("../system/constants.php")) {
if (file_exists(TL_ROOT . '/system/constants.php')) {
$this->existing = true;
} elseif (file_exists("../system/config/constants.php")) {
} elseif (file_exists(TL_ROOT . '/system/config/constants.php')) {
$this->existing = true;
} else {
$this->existing = false;
Expand Down Expand Up @@ -341,8 +341,8 @@ protected function install()
$this->exec($this->unzip . ' download');
$this->exec('rm download');
$folder = $this->exec('ls -d contao-*');
$this->exec("mv $folder/* ../");
$this->exec("mv $folder/.[a-z]* ../"); // see #22
$this->exec("mv $folder/* " . TL_ROOT . '/');
$this->exec("mv $folder/.[a-z]* " . TL_ROOT . '/'); // see #22
$this->exec("rm -rf $folder");
}
} else {
Expand All @@ -352,18 +352,18 @@ protected function install()
if (file_exists('download') && filesize('download') > 0) {
$zip = new ZipArchive;
$zip->open('download');
$zip->extractTo(dirname(dirname(__FILE__)));
$zip->extractTo(TL_ROOT);
$zip->close();
unlink('download');
}

$glob = glob('../contao-*');
$glob = glob(TL_ROOT . '/contao-*');

// Remove the wrapper folder (see #23)
if (!empty($glob)) {
foreach (scandir($glob[0]) as $file) {
if ($file != '.' && $file != '..') {
rename($glob[0] . '/' . $file, '../' . $file);
rename($glob[0] . '/' . $file, TL_ROOT . '/' . $file);
}
}
rmdir($glob[0]);
Expand Down
14 changes: 6 additions & 8 deletions check/controller/validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,10 @@ public function isValid()
*/
protected function findConstants()
{
define('TL_ROOT', dirname(dirname(__FILE__)));

if (file_exists("../system/constants.php")) {
include "../system/constants.php";
} elseif (file_exists("../system/config/constants.php")) {
include "../system/config/constants.php";
if (file_exists(TL_ROOT . '/system/constants.php')) {
include TL_ROOT . '/system/constants.php';
} elseif (file_exists(TL_ROOT . '/system/config/constants.php')) {
include TL_ROOT . '/system/config/constants.php';
} else {
$this->constants = false;
return false;
Expand Down Expand Up @@ -196,11 +194,11 @@ protected function validate()
$md5_code = $md5_file;
}

if (!file_exists('../' . $path)) {
if (!file_exists(TL_ROOT . '/' . $path)) {
$this->valid = false;
$this->errors['missing'][] = $path;
} else {
$buffer = str_replace("\r", '', file_get_contents('../' . $path));
$buffer = str_replace("\r", '', file_get_contents(TL_ROOT . '/' . $path));

// Check the MD5 hash with and without comments
if (strncmp(md5($buffer), $md5_file, 10) !== 0) {
Expand Down
7 changes: 7 additions & 0 deletions check/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Contao Check Changelog
======================

Version 5.2 (2012-12-20)
------------------------

### Fixed
Correctly move the Contao files to their destination in the installer (see #39).


Version 5.1 (2012-11-29)
------------------------

Expand Down
2 changes: 1 addition & 1 deletion check/views/installer.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
</form>
<?php else: ?>
<h3><?php echo _('Installation complete') ?></h3>
<p class="confirm"><?php printf(_('Contao %s has been installed in %s.'), filter_var($_POST['version'], FILTER_SANITIZE_STRING), dirname(dirname(__FILE__))) ?></p>
<p class="confirm"><?php printf(_('Contao %s has been installed in %s.'), filter_var($_POST['version'], FILTER_SANITIZE_STRING), dirname(dirname(dirname(__FILE__)))) ?></p>
<p class="mt"><a href="../contao/install.php" class="btn"><?php echo _('Open the Contao install tool') ?></a></p>
<?php endif; ?>
</div>
Expand Down

0 comments on commit 63e7722

Please sign in to comment.