Changeset 468 for trunk/docs
- Timestamp:
- Feb 20, 2014 3:03:59 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property
svn:mergeinfo
set to
/branches/eli_branch merged eligible
-
Property
svn:mergeinfo
set to
-
trunk/docs/codebase_v1-to-v2_upgrade_checklist.txt
r334 r468 1 <?php2 3 1 ===================================================================== 4 2 In General … … 8 6 9 7 include SITE_BASE . '/_templates/header.ihtml'; 10 8 11 9 do this: 12 10 13 11 include 'header.ihtml'; 14 12 15 13 16 14 2. CODE_BASE is a defunct constant. The location of the codebase is no longer important as long as it can be found in the currently configured include_path. This will usually include the local site directory (where the codebase normally would be found) as well as the server-wide /usr/lib/php directory where the codebase might be included for the whole server. So now, instead of this: 17 15 18 16 require_once CODE_BASE . '/lib/Utilities.inc.php'; 19 17 20 18 do this: 21 19 22 20 require_once 'codebase/lib/Utilities.inc.php'; 23 24 21 22 25 23 3. $CFG-> variables are gone. Most of these should be converted into their $app and $auth equivalents. If a $CFG variable is NOT something used by the codebase but is still needed by the website application, I suggest converting these values to a $cfg array. For example, this: 26 24 27 25 $CFG->gallery_images_url = '/gallery_images'; 28 26 29 27 should become: 30 28 31 29 $cfg['gallery_images_url'] = '/gallery_images'; 32 30 33 31 And of course change the code where they are used to support the array instead of object-properties. If the array is inside of double-quotes it should be written like: 34 32 35 "{$cfg['gallery_images_url']}/my/path". 36 37 If the value used is now to be retrieved from a $object->getParam(...) method call, you'll need to do this: 33 "{$cfg['gallery_images_url']}/my/path". 34 35 If the value used is now to be retrieved from a $object->getParam(...) method call, you'll need to do this: 38 36 39 37 $object->getParam('gallery_images_url') . '/my/path' … … 43 41 44 42 <a href="<?php echo ohref("$CFG->site_url/my/file.php"); ?>"> 45 43 46 44 to this: 47 45 48 46 <a href="<?php echo $app->ohref("/my/file.php"); ?>"> 49 47 50 48 (In other words, the URL should be a not-fully-qualified URL starting with a slash.) 51 49 … … 62 60 '\1' => '\2' 63 61 )); 64 65 62 63 66 64 6. Many classes now require object-method calls, and the object must be globally scoped. For example, to call the $cache->exists() method inside a function, be sure to add: 67 65 68 66 global $cache; 69 67 70 68 at the top of the function. 71 69 72 70 73 71 74 72 ===================================================================== … … 80 78 --------------------------------------------------------------------- 81 79 $CFG global variables are converted to object properties specific to their usage. 82 80 83 81 For example: 84 82 … … 98 96 Convert functions to methods. 99 97 100 raiseMsg(...) $app->raiseMsg(...) 101 logMsg(...) $app->logMsg(...) 98 raiseMsg(...) $app->raiseMsg(...) 99 logMsg(...) $app->logMsg(...) 102 100 include 'message_header.ihtml'; $app->printRaisedMessages(); 103 101 $carry_queries = array(... , ...); $app->carryQuery(...); //call for each value in array 104 ohref(...) $app->ohref(...) 105 printHiddenSession(...); $app->printHiddenSession(...); 106 dieURL(...); $app->dieURL(...); 107 dieBoomerangURL(...); $app->dieBoomerangURL(...); 108 setBoomerangURL(...); $app->setBoomerangURL(...); 109 getBoomerangURL(...); $app->getBoomerangURL(...); 110 validBoomerangURL(...); $app->validBoomerangURL(...); 111 deleteBoomerangURL(...); $app->deleteBoomerangURL(...); 102 ohref(...) $app->ohref(...) 103 printHiddenSession(...); $app->printHiddenSession(...); 104 dieURL(...); $app->dieURL(...); 105 dieBoomerangURL(...); $app->dieBoomerangURL(...); 106 setBoomerangURL(...); $app->setBoomerangURL(...); 107 getBoomerangURL(...); $app->getBoomerangURL(...); 108 validBoomerangURL(...); $app->validBoomerangURL(...); 109 deleteBoomerangURL(...); $app->deleteBoomerangURL(...); 112 110 sslOn(); $app->sslOn(); 113 111 sslOff(); $app->sslOff(); … … 121 119 ===================================================================== 122 120 DB 123 ===================================================================== 121 ===================================================================== 124 122 125 123 dbQuery(...) $db->query(...) … … 209 207 210 208 $lock = new RecordLock($GLOBALS['_admin']); 211 209 212 210 to: 213 211 … … 215 213 global $auth; 216 214 $lock =& Lock::getInstance($auth); 217 215 218 216 And instantiate the original global $lock object in _config.inc.php as follows: 219 217 … … 236 234 237 235 $version = new RecordVersion(); 238 236 239 237 to: 240 238 … … 250 248 Changed all method calls to now require object calls rather than static calls. In other words, change this: 251 249 252 if (SessionCache::isCached('mydata')) { 250 if (SessionCache::isCached('mydata')) { 253 251 $list = SessionCache::getCache('mydata'); 254 252 } … … 304 302 305 303 include_once 'form_error_header.ihtml'; $fv->printErrorMessages(); 306 307 308 ?> -
trunk/docs/examples/_config.inc.php
r432 r468 4 4 * For details visit the project site: <http://trac.strangecode.com/codebase/> 5 5 * Copyright 2001-2012 Strangecode, LLC 6 * 6 * 7 7 * This file is part of The Strangecode Codebase. 8 8 * … … 11 11 * Free Software Foundation, either version 3 of the License, or (at your option) 12 12 * any later version. 13 * 13 * 14 14 * The Strangecode Codebase is distributed in the hope that it will be useful, but 15 15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16 16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 17 * details. 18 * 18 * 19 19 * You should have received a copy of the GNU General Public License along with 20 20 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>. 21 21 */ 22 22 23 /** 23 /** 24 24 * _config.inc.php lives in the document root of the site/application. It is the beginning of everything. 25 25 * … … 28 28 * @since 03 Dec 2005 19:09:32 29 29 */ 30 30 31 31 // The constant __FILE__ must be an absolute directory path, starting with / on unix or C: on windows. 32 32 // To work around a PHP bug always include this config file with: require_once dirname(__FILE__) . '/_config.inc.php'; … … 39 39 define('COMMON_BASE', realpath(dirname(__FILE__) . '/../')); 40 40 41 // The DocRoot for this application. SITE_BASE is different from $_SERVER['DOCUMENT_ROOT'] because the 41 // The DocRoot for this application. SITE_BASE is different from $_SERVER['DOCUMENT_ROOT'] because the 42 42 // latter does not change when using the apache Alias directive or URL Rewriting to define a site. 43 43 define('SITE_BASE', dirname(__FILE__)); … … 148 148 require_once 'codebase/lib/Cache.inc.php'; 149 149 $cache = new Cache('global'); 150 $cache->setParam(array('enabled' => true)); 150 $cache->setParam(array('enabled' => true)); // TODO: Enable caching after site launch. 151 151 152 152 // Setup CSS files to include. These will always be available. 153 153 require_once 'codebase/lib/CSS.inc.php'; 154 154 $css = new CSS(); 155 $css->setParam(array('cache_css' => false)); // /Enable caching after site launch.155 $css->setParam(array('cache_css' => false)); // TODO: Enable caching after site launch. 156 156 $css->setFile('codebase/css/codebase.inc.css'); 157 157 $css->setFile('codebase/css/utilities.inc.css'); … … 170 170 // require_once 'global/config.inc.php'; 171 171 172 ?> -
trunk/docs/examples/contact_form/contact.php
r413 r468 119 119 } 120 120 121 ?> -
trunk/docs/examples/db_auth.inc.php
r404 r468 35 35 'db_pass' => '', 36 36 )); 37 ?> -
trunk/docs/examples/example.cli.php
r396 r468 146 146 147 147 148 ?> -
trunk/docs/examples/script_template.php
r396 r468 60 60 61 61 62 ?>
Note: See TracChangeset
for help on using the changeset viewer.