Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update thinkup via the web * added beta path update/json/version config option * added docs
- Loading branch information
1 parent
62796fc
commit 0fa667c
Showing
25 changed files
with
891 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Web Based Update Guide | ||
=============================== | ||
|
||
The following is a general tutorial for how to update ThinkUp | ||
to the latest version using the web based update tools | ||
|
||
Prerequisites | ||
------------- | ||
- All of your ThinkUp application files and directories must be writable by the web server user. | ||
- You must have at least 100 Megabytes of free disk space available to perform a web based update. | ||
|
||
Run the web based update | ||
------------------------ | ||
To run the web based update you just need to navigate to the update url form within tyour ThinkUP instance: | ||
http://younstall.exampl.com/youthinkuppath/install/update.php | ||
|
||
Troubleshooting | ||
------------------------ | ||
The update tool should alert you to any issues you may have while trying to perform a web based update. | ||
The two most common issue most likely to occur are: | ||
|
||
- Invalid file permissions: Your ThinkUp install directory and all its files must be writeable by the web server user. | ||
- Not enough free file space: You will need to have at least 100 megabytes of free space to perform a web based update. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<?php | ||
/** | ||
* | ||
* ThinkUp/tests/TestOfUpdateController.php | ||
* | ||
* Copyright (c) 2009-2012 Mark Wilkie | ||
* | ||
* LICENSE: | ||
* | ||
* This file is part of ThinkUp (http://thinkupapp.com). | ||
* | ||
* ThinkUp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public | ||
* License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any | ||
* later version. | ||
* | ||
* ThinkUp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
* details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with ThinkUp. If not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
* | ||
* TestOfUpgradeController | ||
* | ||
* @license http://www.gnu.org/licenses/gpl.html | ||
* @copyright 2009-2012 Mark Wilkie | ||
* @author Mark Wilkie <mwilkie[at]gmail[dot]com> | ||
* | ||
*/ | ||
require_once dirname(__FILE__).'/init.tests.php'; | ||
require_once THINKUP_WEBAPP_PATH.'_lib/extlib/simpletest/autorun.php'; | ||
require_once THINKUP_WEBAPP_PATH.'config.inc.php'; | ||
require_once THINKUP_WEBAPP_PATH.'_lib/extlib/simpletest/web_tester.php'; | ||
|
||
class TestOfUpdateController extends ThinkUpUnitTestCase { | ||
|
||
public function setUp(){ | ||
parent::setUp(); | ||
} | ||
|
||
public function tearDown(){ | ||
parent::tearDown(); | ||
Update::$current_exception = false; | ||
} | ||
|
||
/** | ||
* Test controller for non-logged in user | ||
* @TODO Possibly load the resulting markup as a DOM object and test various children in it; | ||
* this would enforce valid markup | ||
*/ | ||
public function testControlNotLoggedIn() { | ||
$config = Config::getInstance(); | ||
$controller = new UpdateController(true); | ||
$results = $controller->go(); | ||
$v_mgr = $controller->getViewManager(); | ||
$config = Config::getInstance(); | ||
$this->assertEqual('You must <a href="'.$config->getValue('site_root_path'). | ||
'session/login.php">log in</a> to do this.', $v_mgr->getTemplateDataItem('error_msg')); | ||
} | ||
|
||
public function testException() { | ||
$this->simulateLogin('me@example.com', true); | ||
$controller = new UpdateController(true); | ||
|
||
} | ||
|
||
public function testReadyToUpdate() { | ||
$this->simulateLogin('me@example.com', true); | ||
$controller = new UpdateController(true); | ||
Update::$current_exception = 'Stuff Happened'; | ||
$results = $controller->go(); | ||
$this->assertPattern('/Stuff Happened/', $results); | ||
|
||
$controller = new UpdateController(true); | ||
Update::$current_exception = false; | ||
$results = $controller->go(); | ||
$v_mgr = $controller->getViewManager(); | ||
$this->assertTrue($v_mgr->getTemplateDataItem('updateable')); | ||
} | ||
|
||
public function testRunUpdate() { | ||
$this->simulateLogin('me@example.com', true); | ||
$_GET['run_update'] = true; | ||
$controller = new UpdateController(true); | ||
Update::$current_exception = 'Stuff Happened'; | ||
$results = $controller->go(); | ||
$this->assertPattern('/Stuff Happened/', $results); | ||
|
||
$controller = new UpdateController(true); | ||
Update::$current_exception = false; | ||
$results = $controller->go(); | ||
$this->assertEqual($controller->redirect_destination, '/install/update.php?ran_update=1'); | ||
} | ||
|
||
public function testRanUpdate() { | ||
$this->simulateLogin('me@example.com', true); | ||
$_GET['ran_update'] = true; | ||
$controller = new UpdateController(true); | ||
Update::$current_exception = 'Stuff Happened'; | ||
$results = $controller->go(); | ||
$this->assertPattern('/ThinkUp Install Has Been Updated/', $results); | ||
} | ||
} | ||
|
||
class Update { | ||
static $current_exception = false; | ||
public function run_update() { | ||
if(self::$current_exception == true) { | ||
throw new Exception(self::$current_exception); | ||
} else { | ||
return array('backup' => '/bla/backup-zipfile.zip', 'config' => '/bla/config.inc.backup.php'); | ||
} | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
this is not valid json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"version":"100.1", "url":"./webapp/nothing.not"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"version":"100.1", "url":"/Users/mark/projects/thinktank/webapp/update/class.TUUpdate.php"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"version":"0.1", "url":"https://github.com/downloads/ginatrapani/ThinkUp/thinkup_0.1.zip"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
<?php | ||
/** | ||
* | ||
* ThinkUp/tests/update/TestOfUpdate.php | ||
* | ||
* Copyright (c) 2009-2012 Mark Wilkie | ||
* | ||
* LICENSE: | ||
* | ||
* This file is part of ThinkUp (http://thinkupapp.com). | ||
* | ||
* ThinkUp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public | ||
* License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any | ||
* later version. | ||
* | ||
* ThinkUp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
* details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with ThinkUp. If not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
* @license http://www.gnu.org/licenses/gpl.html | ||
* @copyright 2009-2012 Mark Wilkie | ||
* @author Mark Wilkie <mwilkie[at]gmail[dot]com> | ||
* | ||
*/ | ||
|
||
require_once dirname(__FILE__).'/../init.tests.php'; | ||
require_once THINKUP_WEBAPP_PATH.'_lib/extlib/simpletest/autorun.php'; | ||
require_once THINKUP_WEBAPP_PATH.'config.inc.php'; | ||
require_once THINKUP_WEBAPP_PATH.'_lib/extlib/simpletest/web_tester.php'; | ||
|
||
class TestOfUpdate extends ThinkUpUnitTestCase { | ||
|
||
public function setUp() { | ||
parent::setUp(); | ||
} | ||
|
||
|
||
public function tearDown() { | ||
|
||
} | ||
|
||
public function testAvailableFileSPace() { | ||
$this->assertTrue(true); | ||
UpdateDiskUtil::$DISK_SPACE_NEEDED = 107374182400 * 10; // 10,000 megs | ||
$tu_update = new Update(); | ||
try { | ||
$tu_update->run_update(); | ||
$this->fail("Should throw an exception..."); | ||
} catch(Exception $e) { | ||
$this->assertPattern('/There is not enough free disk space to perform an update/', $e->getMessage()); | ||
} | ||
UpdateDiskUtil::$DISK_SPACE_NEEDED = 107374182400; // set back to 100 megs | ||
$this->assertFalse(0); | ||
} | ||
|
||
public function testPermissions() { | ||
chmod( THINKUP_WEBAPP_PATH . 'index.php', 0444 ); // make a file not writeable | ||
$tu_update = new Update(); | ||
try { | ||
$tu_update->run_update(); | ||
$this->fail("Should throw an exception..."); | ||
} catch(Exception $e) { | ||
$this->assertPattern('/We do not have permissions to write the file/', $e->getMessage()); | ||
} | ||
chmod( THINKUP_WEBAPP_PATH . 'index.php', 0644 ); // make a file writeable | ||
} | ||
|
||
public function testGetLatestInfo() { | ||
$tu_update = new Update(); | ||
$valid_url = UpdateClient::$UPDATE_URL; | ||
|
||
error_reporting( E_ERROR | E_USER_ERROR ); // turn off warning messages | ||
|
||
// bad url, or bad response... | ||
UpdateClient::$UPDATE_URL = '/badurl/nofile'; | ||
try { | ||
$tu_update->run_update(); | ||
$this->fail("Should throw an exception..."); | ||
} catch(Exception $e) { | ||
$this->assertEqual('Unable to load latest update info from /badurl/nofile', $e->getMessage()); | ||
} | ||
|
||
// bad json in response data | ||
UpdateClient::$UPDATE_URL = THINKUP_WEBAPP_PATH . '../tests/data/update/bad_update_info.txt'; | ||
try { | ||
$tu_update->run_update(); | ||
$this->fail("Should throw an exception..."); | ||
} catch(Exception $e) { | ||
$this->assertEqual('Invalid data received from update server: this is not valid json', $e->getMessage()); | ||
} | ||
|
||
// we do not need to update | ||
UpdateClient::$UPDATE_URL = THINKUP_WEBAPP_PATH . '../tests/data/update/old_update_info.txt'; | ||
try { | ||
$tu_update->run_update(); | ||
$this->fail("Should throw an exception..."); | ||
} catch(Exception $e) { | ||
$this->assertEqual('Thinkup is up to date', $e->getMessage()); | ||
} | ||
// reset | ||
UpdateClient::$UPDATE_URL = $valid_url; | ||
error_reporting( $error_reporting ); // reset error reporting | ||
} | ||
|
||
public function testGetLatestUpdateFile() { | ||
$tu_update = new Update(); | ||
$valid_url = UpdateClient::$UPDATE_URL; | ||
|
||
error_reporting( E_ERROR | E_USER_ERROR ); // turn off warning messages | ||
// we do need to update, but have an bad download url | ||
UpdateClient::$UPDATE_URL = THINKUP_WEBAPP_PATH . '../tests/data/update/new_update_info_bad_url.txt'; | ||
try { | ||
$tu_update->run_update(); | ||
$this->fail("Should throw an exception..."); | ||
} catch(Exception $e) { | ||
$this->assertEqual('Unable to download latest update file ./webapp/nothing.not', $e->getMessage()); | ||
} | ||
|
||
// we do need to update, but have an bad zip file | ||
UpdateClient::$UPDATE_URL = THINKUP_WEBAPP_PATH . '../tests/data/update/new_update_info_bad_zip2.txt'; | ||
|
||
file_put_contents(UpdateClient::$UPDATE_URL, | ||
'{"version":"100.1", "url":"' . THINKUP_WEBAPP_PATH . '_lib/model/update/class.Update.php"}'); | ||
try { | ||
$tu_update->run_update(); | ||
$this->fail("Should throw an exception..."); | ||
} catch(Exception $e) { | ||
$this->assertPattern('/Unable to open update zip file, corrupted zip file?/', $e->getMessage()); | ||
} | ||
unlink(UpdateClient::$UPDATE_URL); | ||
|
||
// reset | ||
UpdateClient::$UPDATE_URL = $valid_url; | ||
error_reporting( $error_reporting ); // reset error reporting | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.