------------------------------------------------------------
revno: 1026
committer: Jon Phillips <[email protected]>
branch nick: public
timestamp: Mon 2012-01-16 12:17:04 +0800
message:
* moved relevant contents of defs.php to configs/config.php
* added back AUTHORS
* added libs/Util.php to handle finding revision number on demand, we shoul
keep .bzr around, but possibly strip for releases
* added unit test for the Util.php file. Unit test really great! Recommend!!!
* fixed extra / in the .htaccess
* added getting the file contents of the AUTHORS file to libs/installer.php
** next will conver to Util
* added code to get the last revision number to the installer
removed:
configs/defs.php
added:
AUTHORS
libs/Util.php
tests/libs/UtilTest.php
modified:
configs/config.php
configs/htaccess.inc
libs/installer.php
tests/bootstrap.php
tests/libs/LogTest.php
tests/phpunit.xml
--
lp:aikiframework
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk
Your team Aiki Framework Developers is subscribed to branch lp:aikiframework.
To unsubscribe from this branch go to
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk/+edit-subscription
=== added file 'AUTHORS'
--- AUTHORS 1970-01-01 00:00:00 +0000
+++ AUTHORS 2012-01-16 04:17:04 +0000
@@ -0,0 +1,13 @@
+Aiki Lab Pte Ltd
+Fabricatorz LLC
+Bassel Safadi
+Jon Phillips
+Christopher Adams
+Barry Threw
+Michi Krnac
+Ronaldo Barbachano
+Vera Lobatcheva
+Brad Phillips
+Steven Garcia
+Roger Martín
+Jakub Jankiewicz
=== modified file 'configs/config.php'
--- configs/config.php 2012-01-15 14:44:01 +0000
+++ configs/config.php 2012-01-16 04:17:04 +0000
@@ -17,10 +17,6 @@
* @package Configs
* @filesource */
-/** @see defs.php */
-if ( file_exists("$AIKI_ROOT_DIR/configs/defs.php") ){
- require_once("$AIKI_ROOT_DIR/configs/defs.php");
-}
/**
* These are needed in the web installer
@@ -34,6 +30,106 @@
define("AIKI_SITE_URL", "@AIKI_SITE_URL@");
}
+
+/** Aiki Framework Revision */
+if (!defined("AIKI_REVISION"))
+ define("AIKI_REVISION", "@REVISION@");
+
+/** Aiki Log Directory */
+if (!defined("AIKI_LOG_DIR"))
+ define("AIKI_LOG_DIR", "@AIKI_LOG_DIR@");
+
+/** Aiki Log File Name */
+if (!defined("AIKI_LOG_FILE"))
+ define("AIKI_LOG_FILE", "@AIKI_LOG_FILE@");
+
+/** Aiki Host Profile File Name */
+if (!defined("AIKI_LOG_PROFILE"))
+ define("AIKI_LOG_PROFILE", "@AIKI_LOG_PROFILE@");
+
+/** Aiki Log Level */
+if (!defined("AIKI_LOG_LEVEL"))
+ define("AIKI_LOG_LEVEL", "@AIKI_LOG_LEVEL@");
+
+/** Aiki directory that stores downloads and
+ * backup files used to revert from update */
+if (!defined("AIKI_SAVE_DIR"))
+ define("AIKI_SAVE_DIR", "@AIKI_SAVE_DIR@");
+
+/** Aiki directory that stores downloads.
+ * This must be relative to the aiki save directory */
+if (!defined("AIKI_DOWNLOAD_DIR"))
+ define("AIKI_DOWNLOAD_DIR", "@AIKI_DOWNLOAD_DIR@");
+
+/** Aiki directory that stores backups.
+ * This must be relative to the aiki save directory */
+if (!defined("AIKI_BACKUP_DIR"))
+ define("AIKI_BACKUP_DIR", "@AIKI_BACKUP_DIR@");
+
+/** Aiki directory that stores updates.
+ * This must be relative to the aiki save directory */
+if (!defined("AIKI_UPDATE_DIR"))
+ define("AIKI_UPDATE_DIR", "@AIKI_UPDATE_DIR@");
+
+/** Aiki Random string should be different everytime
+ * a distribution package is configured and built */
+if (!defined("AIKI_RANDOM"))
+ define("AIKI_RANDOM", "@AIKI_RANDOM@");
+
+// **** Begin non-generated constants **** //
+
+/** Aiki Update URL with update information and requirements */
+if (!defined("AIKI_UPDATE_URL"))
+ define("AIKI_UPDATE_URL", "http://aikiframework.org/files/update");
+
+/** Whether or not to check for update after admin login */
+if (!defined("AIKI_UPDATE_CHECK"))
+ define("AIKI_UPDATE_CHECK", true);
+
+/** Aiki Update URL to the update package excluding filename */
+if (!defined("AIKI_UPDATE_PATH"))
+ define("AIKI_UPDATE_PATH", "http://aikiframework.org/files/");
+
+/** First part of the update package filename excluding version and extension */
+if (!defined("AIKI_UPDATE_PREFIX"))
+ define("AIKI_UPDATE_PREFIX", "aiki-src-");
+
+/** Last part of the update package filename indicating file format */
+if (!defined("AIKI_UPDATE_EXT"))
+ define("AIKI_UPDATE_EXT", ".zip");
+
+/** Last part of the sum filename indicating file format */
+if (!defined("AIKI_SUM_EXT"))
+ define("AIKI_SUM_EXT", ".shasum-256.txt");
+
+/** Retry to download or validate the downloaded update package
+ * this number of times if failed. Do NOT put the following value in quotes. */
+if (!defined("AIKI_UPDATE_RETRY"))
+ define("AIKI_UPDATE_RETRY", 3);
+
+/** Whether or not this update involves changes to the Aiki
+ * configuration (aiki_config table, config.php or .htaccess)
+ * Do NOT put the following value (TRUE or FALSE) in quotes. */
+if (!defined("AIKI_UPDATE_CONFIG"))
+ define("AIKI_UPDATE_CONFIG", false);
+
+/* the following error related constants
+ * are built-in on newer versions of PHP */
+if (!defined("E_RECOVERABLE_ERROR")) {
+ /** Define E_RECOVERABLE_ERROR if not defined */
+ define("E_RECOVERABLE_ERROR", 4096);
+}
+if (!defined("E_DEPRECATED")) {
+ /** Define E_DEPRECATED if not defined */
+ define("E_DEPRECATED", 8192);
+}
+if (!defined("E_USER_DEPRECATED")) {
+ /** Define E_USER_DEPRECATED if not defined */
+ define("E_USER_DEPRECATED", 16384);
+}
+
+
+
/** Used to store global configuration options
* @global array $config */
$config = array();
=== removed file 'configs/defs.php'
--- configs/defs.php 2012-01-15 15:26:53 +0000
+++ configs/defs.php 1970-01-01 00:00:00 +0000
@@ -1,123 +0,0 @@
-<?php
-
-/** Aiki Framework (PHP)
- *
- * Some of the values for the define statements in this file are generated
- * automatically when the autoconf configure script is executed.
- * These are meant to be used as the default configuration. Please,
- * be aware that the configuration is expected change during run-time.
- * This resulting file name will be defs.php and is meant for ALL
- * types of the distribution packages. This file should only contain
- * constants that can be reasonably shared between all distributions.
- * This means that during configuration of a distribution, the values
- * can be set to generally support all the targeted platforms
- * as well as a specific platform.
- *
- * LICENSE
- *
- * This source file is subject to the AGPL-3.0 license that is bundled
- * with this package in the file LICENSE.
- *
- * @author Aikilab http://www.aikilab.com
- * @copyright (c) 2008-2011 Aiki Lab Pte Ltd
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
- * @link @PACKAGE_URL@
- * @category Aiki
- * @package Configs
- * @version @VERSION@.@REVISION@
- * @filesource */
-
- // @TODO: move the defs.inc to defs.php
- // @TODO: make all these check to see if another define exists before defining
- // @TODO: make sure its easy to move a site by setting an option in a file
-
-
-// @TODO added these back from aiki-defs.inc and need to be defined in installer
-/** Aiki Site URL */
-define("AIKI_SITE_URL", "@AIKI_SITE_URL@");
-
-/** Aiki Rewrite Base (for htaccess) */
-define("AIKI_REWRITE_BASE", "@AIKI_REWRITE_BASE@");
-
-
-/** Aiki Framework Revision */
-define("AIKI_REVISION", "@REVISION@");
-
-/** Aiki Authors */
-define("AIKI_AUTHORS", 'Aiki Lab Pte Ltd, Fabricatorz LLC, Bassel Safadi, Jon Phillips, Christopher Adams, Barry Threw, Michi Krnac, Ronaldo Barbachano, Vera Lobatcheva, Brad Phillips, Steven Garcia, Roger Martín, Jakub Jankiewicz');
-
-/** Aiki Log Directory */
-define("AIKI_LOG_DIR", "@AIKI_LOG_DIR@");
-
-/** Aiki Log File Name */
-define("AIKI_LOG_FILE", "@AIKI_LOG_FILE@");
-
-/** Aiki Host Profile File Name */
-define("AIKI_LOG_PROFILE", "@AIKI_LOG_PROFILE@");
-
-/** Aiki Log Level */
-define("AIKI_LOG_LEVEL", "@AIKI_LOG_LEVEL@");
-
-/** Aiki directory that stores downloads and
- * backup files used to revert from update */
-define("AIKI_SAVE_DIR", "@AIKI_SAVE_DIR@");
-
-/** Aiki directory that stores downloads.
- * This must be relative to the aiki save directory */
-define("AIKI_DOWNLOAD_DIR", "@AIKI_DOWNLOAD_DIR@");
-
-/** Aiki directory that stores backups.
- * This must be relative to the aiki save directory */
-define("AIKI_BACKUP_DIR", "@AIKI_BACKUP_DIR@");
-
-/** Aiki directory that stores updates.
- * This must be relative to the aiki save directory */
-define("AIKI_UPDATE_DIR", "@AIKI_UPDATE_DIR@");
-
-/** Aiki Random string should be different everytime
- * a distribution package is configured and built */
-define("AIKI_RANDOM", "@AIKI_RANDOM@");
-
-// **** Begin non-generated constants **** //
-
-/** Aiki Update URL with update information and requirements */
-define("AIKI_UPDATE_URL", "http://aikiframework.org/files/update");
-
-/** Whether or not to check for update after admin login */
-define("AIKI_UPDATE_CHECK", true);
-
-/** Aiki Update URL to the update package excluding filename */
-define("AIKI_UPDATE_PATH", "http://aikiframework.org/files/");
-
-/** First part of the update package filename excluding version and extension */
-define("AIKI_UPDATE_PREFIX", "aiki-src-");
-
-/** Last part of the update package filename indicating file format */
-define("AIKI_UPDATE_EXT", ".zip");
-
-/** Last part of the sum filename indicating file format */
-define("AIKI_SUM_EXT", ".shasum-256.txt");
-
-/** Retry to download or validate the downloaded update package
- * this number of times if failed. Do NOT put the following value in quotes. */
-define("AIKI_UPDATE_RETRY", 3);
-
-/** Whether or not this update involves changes to the Aiki
- * configuration (aiki_config table, config.php or .htaccess)
- * Do NOT put the following value (TRUE or FALSE) in quotes. */
-define("AIKI_UPDATE_CONFIG", false);
-
-/* the following error related constants
- * are built-in on newer versions of PHP */
-if (!defined("E_RECOVERABLE_ERROR")) {
- /** Define E_RECOVERABLE_ERROR if not defined */
- define("E_RECOVERABLE_ERROR", 4096);
-}
-if (!defined("E_DEPRECATED")) {
- /** Define E_DEPRECATED if not defined */
- define("E_DEPRECATED", 8192);
-}
-if (!defined("E_USER_DEPRECATED")) {
- /** Define E_USER_DEPRECATED if not defined */
- define("E_USER_DEPRECATED", 16384);
-}
=== modified file 'configs/htaccess.inc'
--- configs/htaccess.inc 2012-01-06 11:46:59 +0000
+++ configs/htaccess.inc 2012-01-16 04:17:04 +0000
@@ -5,7 +5,7 @@
Options +FollowSymLinks
RewriteEngine on
-RewriteBase @AIKI_REWRITE_BASE@/
+RewriteBase @AIKI_REWRITE_BASE@
RewriteRule ^image/(.*)px/(.*)/(.*) assets/apps/image_viewer.php?id=$3&size=$1&mode=$2
RewriteRule ^image/(.*)px/(.*) assets/apps/image_viewer.php?id=$2&size=$1
RewriteRule ^image/(.*) assets/apps/image_viewer.php?id=$1
=== added file 'libs/Util.php'
--- libs/Util.php 1970-01-01 00:00:00 +0000
+++ libs/Util.php 2012-01-16 04:17:04 +0000
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Aiki Framework (PHP)
+ *
+ * LICENSE
+ *
+ * This source file is subject to the AGPL-3.0 license that is bundled
+ * with this package in the file LICENSE.
+ *
+ * @author Jon Phillips
+ * @copyright (c) 2008-2011 Aiki Lab Pte Ltd
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @link http://www.aikiframework.org
+ * @category Aiki
+ * @package Library
+ * @filesource
+ */
+
+if(!defined('IN_AIKI')) {
+ die('No direct script access allowed');
+}
+
+
+/**
+ * A utility class for some global strange operations, until the get a new home.
+ *
+ * Use like: Util::get_last_revision();
+ *
+ *
+ */
+
+
+class Util {
+
+ /**
+ * Returns the last revision of aiki if .bzr exists, or 0 assuming this
+ * is a release, since .bzr is stripped out.
+ *
+ * @return number
+ */
+
+ public static function get_last_revision() {
+ global $AIKI_ROOT_DIR;
+ $last_revision_file = $AIKI_ROOT_DIR . "/.bzr/branch/last-revision";
+ $last_revision = '0';
+ if ( file_exists($last_revision_file) )
+ list($last_revision) =
+ explode(' ', file_get_contents($last_revision_file) );
+
+ return $last_revision;
+ }
+}
=== modified file 'libs/installer.php'
--- libs/installer.php 2012-01-11 14:37:54 +0000
+++ libs/installer.php 2012-01-16 04:17:04 +0000
@@ -23,6 +23,8 @@
die('No direct script access allowed');
}
+/** @see Util.php */
+require_once("$AIKI_ROOT_DIR/libs/Util.php");
/* setting $config["log_level"] = "NONE" disables the log
* or "None" and "none". Also if the log_level is not valid
@@ -327,8 +329,9 @@
$sql_insert_variable = str_replace("@ADMIN_PASS@", $admin_password_md5_md5, $sql_insert_variable);
$sql_insert_variable = str_replace("@ADMIN_MAIL@", $email, $sql_insert_variable);
$sql_insert_variable = str_replace("@VERSION@", AIKI_VERSION, $sql_insert_variable);
- $sql_insert_variable = str_replace("@REVISION@", AIKI_REVISION, $sql_insert_variable);
- $sql_insert_variable = str_replace("@AUTHORS@", AIKI_AUTHORS, $sql_insert_variable);
+ $sql_insert_variable = str_replace("@REVISION@", Util::get_last_revision(), $sql_insert_variable);
+ $sql_insert_variable = str_replace("@AUTHORS@",
+ file_get_contents("$AIKI_ROOT_DIR/AUTHORS"), $sql_insert_variable);
/* In MySQL, the “-- ” (double-dash) comment style requires the second
* dash to be followed by at least one whitespace or control character.
=== modified file 'tests/bootstrap.php'
--- tests/bootstrap.php 2012-01-06 10:30:01 +0000
+++ tests/bootstrap.php 2012-01-16 04:17:04 +0000
@@ -9,5 +9,13 @@
* __DIR__ . "/../build/src" . PATH_SEPARATOR .
*/
set_include_path(
+ __DIR__ . "/.." . PATH_SEPARATOR .
get_include_path()
);
+
+/** define this for script access */
+define("IN_AIKI", TRUE);
+
+
+$AIKI_ROOT_DIR = realpath(dirname(__FILE__)) . '/..';
+// echo $AIKI_ROOT_DIR;
=== modified file 'tests/libs/LogTest.php'
--- tests/libs/LogTest.php 2012-01-06 10:11:31 +0000
+++ tests/libs/LogTest.php 2012-01-16 04:17:04 +0000
@@ -17,9 +17,6 @@
* @package Tests
* @filesource */
-/** define this for script access */
-define("IN_AIKI", TRUE);
-
require_once("libs/Log.php");
/** To test protected properties and methods */
@@ -44,4 +41,4 @@
// test protected property value
$this->assertSame("NONE", $log->getAllow());
}
-}
\ No newline at end of file
+}
=== added file 'tests/libs/UtilTest.php'
--- tests/libs/UtilTest.php 1970-01-01 00:00:00 +0000
+++ tests/libs/UtilTest.php 2012-01-16 04:17:04 +0000
@@ -0,0 +1,34 @@
+<?php
+
+/** Aiki Framework Tests (PHP)
+ *
+ * Tests the Util utility.
+ *
+ * LICENSE
+ *
+ * This source file is subject to the AGPL-3.0 license that is bundled
+ * with this package in the file LICENSE.
+ *
+ * @author Aikilab http://www.aikilab.com
+ * @copyright (c) 2008-2011 Aiki Lab Pte Ltd
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @link http://www.aikiframework.org
+ * @category Aiki
+ * @package Tests
+ * @filesource */
+
+
+require_once("libs/Util.php");
+
+/** This is the test class which should be the same as the file name */
+class UtilTest extends PHPUnit_Framework_TestCase {
+
+ public function testLastRevisionReal() {
+
+ $last_revision = Util::get_last_revision();
+ // echo $last_revision;
+
+ // make sure not empty
+ $this->assertNotEmpty($last_revision);
+ }
+}
=== modified file 'tests/phpunit.xml'
--- tests/phpunit.xml 2012-01-06 10:11:31 +0000
+++ tests/phpunit.xml 2012-01-16 04:17:04 +0000
@@ -14,6 +14,7 @@
<testsuites>
<testsuite name="Aiki Test Suite">
<file>libs/LogTest.php</file>
+ <file>libs/UtilTest.php</file>
</testsuite>
</testsuites>
</phpunit>
_______________________________________________
Mailing list: https://launchpad.net/~aikiframework-devel
Post to : [email protected]
Unsubscribe : https://launchpad.net/~aikiframework-devel
More help : https://help.launchpad.net/ListHelp