Changeset 1294
- Timestamp:
- 09/17/07 13:25:32 (1 year ago)
- Files:
-
- trunk/wifidog-auth/CHANGELOG (modified) (1 diff)
- trunk/wifidog-auth/wifidog/classes/DependenciesList.php (modified) (1 diff)
- trunk/wifidog-auth/wifidog/classes/Dependency.php (modified) (7 diffs)
- trunk/wifidog-auth/wifidog/classes/SmartyWifidog.php (modified) (1 diff)
- trunk/wifidog-auth/wifidog/install.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wifidog-auth/CHANGELOG
r1292 r1294 1 1 # $Id$ 2 2007-09-17 Benoit Grégoire <bock@step.polymtl.ca> 3 * SmartyWifidog: If ANY of the mandatory dependencies (not just smarty) are missing, user will be redirected to the install script 4 * Move Smarty detection and install to common framework. Take this opportunity to move to upgrade to latest Smarty since people will have to re-run the install script anyway. 5 * Fix #381 by applying patch from leandro@texnet.it, mea-culpa, I didn't know I broke the install script. 6 2 7 2007-09-12 Benoit Grégoire <bock@step.polymtl.ca> 3 8 * Scratch a few itches: Fix the link from node admin to stats, minor CSS fixes trunk/wifidog-auth/wifidog/classes/DependenciesList.php
r1287 r1294 131 131 $html .= "</table>"; 132 132 133 $components = Dependency::getDependenc y();133 $components = Dependency::getDependencies(); 134 134 $html .= "<table BORDER=\"1\">\n"; 135 135 $html .= "<tr><th>"._("Component").'<br/>'._("Click for the component's website")."</th>\n"; trunk/wifidog-auth/wifidog/classes/Dependency.php
r1287 r1294 55 55 56 56 require_once ('classes/Utils.php'); 57 define('OPENID_PATH', WIFIDOG_ABS_FILE_PATH.'lib/php-openid-2.0.0-rc2/'); 57 58 define('OPENID_PATH', WIFIDOG_ABS_FILE_PATH.'lib/php-openid-2.0.0-rc2/'); 59 define('SMARTY_PATH', WIFIDOG_ABS_FILE_PATH.'lib/Smarty-2.6.18/libs/'); 58 60 /** 59 61 * This class checks the existence of components required by WiFiDog. … … 71 73 { 72 74 /** 73 * List of components used by WiFiDog 74 * 75 * An array of components used by WiFiDog 76 * The main array key is the EXACT name name of the dependency. Do NOT translate it or blindly change it; 77 * It is used in the code if various ways, for example to detect PHP or PEAR modules 78 * Documentation of the various array keys: 79 * 'mandatory' => Optional. Set to true if the dependency absolutely required for basic operation of an auth server 80 * 'type' => Mandatory. The type of Dependency. Currently, allowed values are: 81 * "phpExtension": Standard PHP extension 82 * "peclStandard": Standard (in the PECL reposidory) PECL PHP module 83 * "peclStandard": Standard (in the PEAR reposidory) PEAR PHP module 84 * "pearCustom": PEAR-compatible tarball 85 * "localLib": Custom PHP extension, to be downloaded and installed in wifidog/lib 86 * 'detectFiles' => Mandatory for most type of dependencies, the relative path to the file that must exist for the dependency to be considered present. 87 * The path is relative to the PHP path, or wifidog/lib depending on the type of install 88 * 'description' => Description of the dependency, and what it's used for in wifidog 89 * 'website' => URL to the dependency's official website 90 * 'installSourceUrl' => For localLib and pearCustom dependency, the URL where the dependency can be downloaded. 91 * 'installMethod' => For localLib, the protocol to be used to download and install the dependency. Currently, allowed values are: 92 * 'tarball': Decompress a tarball in wifidog/lib 93 * 'installDestination' => For localLib, the path, relative to wifidog/lib where the dependency should be installed 94 * 75 95 * @var array 76 96 */ … … 79 99 /* PHP extensions (mandatory) */ 80 100 'mbstring' => array ( 81 'mandatory' => 1,101 'mandatory' => true, 82 102 "type" => "phpExtension", 83 103 'description' => 'Required for core auth-server and RSS support' 84 104 ), 85 105 'session' => array ( 86 'mandatory' => 1,106 'mandatory' => true, 87 107 "type" => "phpExtension", 88 108 'description' => 'Required for core auth-server' 89 109 ), 90 110 'pgsql' => array ( 91 'mandatory' => 1,111 'mandatory' => true, 92 112 "type" => "phpExtension", 93 113 'description' => 'Required for auth-server to connect to Postgresql database' 94 114 ), 95 115 "Smarty" => array ( 116 'mandatory' => true, 117 "type" => "localLib", 118 "detectFiles" => "lib/Smarty-2.6.18/libs/Smarty.class.php", 119 'description' => "Required for all parts of wifidog", 120 'website' => "http://smarty.php.net/", 121 'installSourceUrl' => "http://smarty.php.net/do_download.php?download_file=Smarty-2.6.18.tar.gz", 122 'installMethod' => "tarball", 123 'installDestination' => "/" 124 ), 96 125 /* PHP extensions (optional) */ 97 126 'gettext' => array ( … … 146 175 147 176 /* Locally installed libraries */ 148 "Smarty" => array (149 "type" => "localLib",150 "detectFiles" => "lib/smarty/Smarty.class.php",151 'description' => "Required for all parts of wifidog",152 'website' => "http://smarty.php.net/"153 ),154 177 "FCKeditor" => array ( 155 178 "type" => "localLib", … … 247 270 * @return boolean Returns whether the file has been found or not. 248 271 */ 249 public static function getDependenc y()272 public static function getDependencies() 250 273 { 251 274 $retval = array(); … … 396 419 } 397 420 421 /** 422 * Checks if one of the mandatory components is missing. 423 * 424 * @param string $errmsg Reference of a string which would contain an 425 * error message. 426 * 427 * @return boolean Returns false if any components are missing. 428 */ 429 public static function checkMandatoryComponents(&$errmsg = null) 430 { 431 // Init values 432 $returnValue = true; 433 $components = self::getDependencies(); 434 foreach($components as $component) { 435 if($component->isMandatory()) { 436 $returnValue &= self::check($component->getId(), $errmsg); 437 } 438 } 439 440 return $returnValue; 441 } 442 398 443 /** Use PHP internal functions to download a file */ 399 444 static public function downloadFile($remoteURL, $localPath) { … … 424 469 break; 425 470 case "localLib": 426 $name = $this->getId().'_install'; 427 $html .= sprintf(_("<input type='submit' name='%s' value='Install %s'/>"), $name,$this->getId()); 471 if($this->getInstallSourceUrl()) { 472 $name = $this->getId().'_install'; 473 $value = sprintf(_("Install %s"), $this->getId()); 474 $html .= sprintf("<input type='submit' name='%s' value='%s'/>", $name, $value); 475 476 } 477 else { 478 $html .= sprintf(_("Sorry, i couldn't find the source for %s in installSourceUrl"), $this->getId()); 479 } 480 428 481 429 482 break; trunk/wifidog-auth/wifidog/classes/SmartyWifidog.php
r1249 r1294 47 47 require_once("classes/Locale.php"); 48 48 require_once("classes/Utils.php"); 49 require_once("include/smarty.resource.string.php"); 50 51 // Check if Smarty installed, if not redirect user to web-base installation 52 if (Dependency::check("Smarty", $errmsg)) { 49 // Check if all mandatory components (such as Smarty) installed, if not redirect user to web-base installation 50 if (Dependency::checkMandatoryComponents($errmsg)) { 53 51 // Load Smarty library 54 require_once( 'lib/smarty/Smarty.class.php');52 require_once(SMARTY_PATH.'Smarty.class.php'); 55 53 } else { 56 54 // Build the system_path for the auth-server 57 print "Redirecting to Wifidog web-based install script since Smarty is missing (Error was: $errmsg)<META HTTP-EQUIV=Refresh CONTENT=\"5; URL=".BASE_URL_PATH."/install.php\">";55 print "Redirecting to Wifidog web-based install script since a mandatory Dependency is missing (Error was: $errmsg)<META HTTP-EQUIV=Refresh CONTENT=\"5; URL=".BASE_URL_PATH."/install.php\">"; 58 56 exit(); 59 57 } 60 58 require_once("include/smarty.resource.string.php"); 61 59 /* 62 60 * Smarty plugin trunk/wifidog-auth/wifidog/install.php
r1289 r1294 166 166 'tmp/simplepie_cache', 167 167 'lib/', 168 'lib/smarty',169 'lib/smarty/plugins',170 168 'tmp/smarty/templates_c', 171 169 'tmp/smarty/cache', … … 500 498 array ( 501 499 "title" => "Next", 502 "page" => "s marty"500 "page" => "simplepie" 503 501 ) 504 502 )); … … 506 504 507 505 break; 508 ###################################509 case 'smarty' : // Download, uncompress and install Smarty510 print<<< EndHTML511 <h1>Smarty template engine installation</h1>512 <p><A HREF="http://smarty.php.net/">Smarty</A> is Template Engine. WifiDog requires you install it before you continue.</p>513 EndHTML;514 if ($neededPackages['smarty']['available']) {515 print "Already installed !<br/>";516 }517 else {518 $output = WIFIDOG_ABS_FILE_PATH."tmp/";519 //chdir($output);520 list ($url, $filename) = split("=", $smarty_full_url);521 522 print "Download source code ($filename) : ";523 if (!file_exists($output.$filename))524 Dependency::downloadFile($smarty_full_url, $output.$filename);525 526 if (!file_exists($output.$filename)) {527 print "<B STYLE=\"color:red\">Error</b><p>Current working directory : <em>$output</em>";528 print "<pre><em>wget \"$smarty_full_url\"</em>\n$output</pre>";529 exit ();530 }531 else {532 print "OK<BR>";533 }534 535 print "Uncompressing : ";536 $dir_array = split(".tar.gz", $output.$filename);537 $dirname = array_shift($dir_array);538 539 if (!file_exists($dirname))540 Dependency::execVerbose("cd $output; tar -xzf $dirname.tar.gz", $output, $return);541 print "OK<BR>";542 print "Copying : ";543 if (!file_exists(WIFIDOG_ABS_FILE_PATH . "lib/smarty"));544 Dependency::execVerbose("cp -r $dirname/libs/* " . WIFIDOG_ABS_FILE_PATH . "/lib/smarty", $output, $return); # TODO : Utiliser SMARTY_REL_PATH545 print "OK<BR>";546 547 refreshButton();548 }549 navigation(array (550 array (551 "title" => "Back",552 "page" => "version"553 ),554 array (555 "title" => "Next",556 "page" => "simplepie"557 )558 ));559 break;560 506 ################################### 561 507 case 'simplepie' : // Download, uncompress and install SimplePie … … 576 522 } 577 523 elseif ($action == 'install') { 578 524 require_once (dirname(__FILE__) . '/include/common.php'); 579 525 print "Download source code frpm svn($filename) : "; 580 526 Dependency::execVerbose("svn co ".escapeshellarg($neededPackages['simplepie']['svn_source'])." ".escapeshellarg(WIFIDOG_ABS_FILE_PATH."lib/simplepie"), $output, $return); … … 634 580 } 635 581 elseif ($action == 'install') { 636 582 require_once (dirname(__FILE__) . '/include/common.php'); 637 583 print "Download source code frpm svn($filename) : "; 638 584 Dependency::execVerbose("svn co ".escapeshellarg($neededPackages['feedpressreview']['svn_source'])." ".escapeshellarg(WIFIDOG_ABS_FILE_PATH."lib/feedpressreview"), $output, $return);
