Got rid of a bunch of ugly warnings

This commit is contained in:
Zach Copley 2009-09-15 16:31:09 -07:00
parent 38409f1683
commit 94466da35a
1 changed files with 20 additions and 20 deletions

View File

@ -1,5 +1,5 @@
<?php <?php
/** /**
* StatusNet - the distributed open-source microblogging tool * StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2009, StatusNet, Inc. * Copyright (C) 2009, StatusNet, Inc.
* *
@ -15,10 +15,10 @@
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* @category Installation * @category Installation
* @package Installation * @package Installation
* *
* @author Adrian Lang <mail@adrianlang.de> * @author Adrian Lang <mail@adrianlang.de>
* @author Brenda Wallace <shiny@cpan.org> * @author Brenda Wallace <shiny@cpan.org>
* @author Brett Taylor <brett@webfroot.co.nz> * @author Brett Taylor <brett@webfroot.co.nz>
@ -33,7 +33,7 @@
* @author Tom Adams <tom@holizz.com> * @author Tom Adams <tom@holizz.com>
* @license GNU Affero General Public License http://www.gnu.org/licenses/ * @license GNU Affero General Public License http://www.gnu.org/licenses/
*/ */
define('INSTALLDIR', dirname(__FILE__)); define('INSTALLDIR', dirname(__FILE__));
$external_libraries=array( $external_libraries=array(
@ -211,10 +211,10 @@ $dbModules = array(
), ),
); );
/** /**
* the actual installation. * the actual installation.
* If call libraries are present, then install * If call libraries are present, then install
* *
* @return void * @return void
*/ */
function main() function main()
@ -222,8 +222,8 @@ function main()
if (!checkPrereqs()) { if (!checkPrereqs()) {
return; return;
} }
if ($_GET['checklibs']) { if (!empty($_GET['checklibs'])) {
showLibs(); showLibs();
} else { } else {
if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_SERVER['REQUEST_METHOD'] == 'POST') {
@ -243,7 +243,7 @@ function main()
*/ */
function haveExternalLibrary($external_library) function haveExternalLibrary($external_library)
{ {
if (isset($external_library['include']) && ! include_once $external_library['include'] ) { if (isset($external_library['include']) && ! @include_once $external_library['include'] ) {
return false; return false;
} }
if (isset($external_library['check_function']) && ! function_exists($external_library['check_function'])) { if (isset($external_library['check_function']) && ! function_exists($external_library['check_function'])) {
@ -282,7 +282,7 @@ function checkPrereqs()
printf('<p class="error">Cannot load required extension: <code>%s</code></p>', $req); printf('<p class="error">Cannot load required extension: <code>%s</code></p>', $req);
$pass = false; $pass = false;
} }
} }
// Make sure we have at least one database module available // Make sure we have at least one database module available
global $dbModules; global $dbModules;
$missingExtensions = array(); $missingExtensions = array();
@ -291,13 +291,13 @@ function checkPrereqs()
$missingExtensions[] = $info['check_module']; $missingExtensions[] = $info['check_module'];
} }
} }
if (count($missingExtensions) == count($dbModules)) { if (count($missingExtensions) == count($dbModules)) {
$req = implode(', ', $missingExtensions); $req = implode(', ', $missingExtensions);
printf('<p class="error">Cannot find mysql or pgsql extension. You need one or the other: <code>%s</code></p>', $req); printf('<p class="error">Cannot find mysql or pgsql extension. You need one or the other.');
$pass = false; $pass = false;
} }
if (!is_writable(INSTALLDIR)) { if (!is_writable(INSTALLDIR)) {
printf('<p class="error">Cannot write config file to: <code>%s</code></p>', INSTALLDIR); printf('<p class="error">Cannot write config file to: <code>%s</code></p>', INSTALLDIR);
printf('<p>On your server, try this command: <code>chmod a+w %s</code>', INSTALLDIR); printf('<p>On your server, try this command: <code>chmod a+w %s</code>', INSTALLDIR);
@ -365,19 +365,19 @@ function showLibs()
E_O_T; E_O_T;
foreach ($absent_libraries as $library) { foreach ($absent_libraries as $library) {
echo '<li>'; echo '<li>';
if ($library['url']) { if (isset($library['url'])) {
echo '<a href=">'.$library['url'].'">'.htmlentities($library['name']).'</a>'; echo '<a href=">'.$library['url'].'">'.htmlentities($library['name']).'</a>';
} else { } else {
echo htmlentities($library['name']); echo htmlentities($library['name']);
} }
echo '<ul>'; echo '<ul>';
if ($library['deb']) { if (isset($library['deb'])) {
echo '<li class="deb package">deb: <a href="apt:' . urlencode($library['deb']) . '">' . htmlentities($library['deb']) . '</a></li>'; echo '<li class="deb package">deb: <a href="apt:' . urlencode($library['deb']) . '">' . htmlentities($library['deb']) . '</a></li>';
} }
if ($library['rpm']) { if (isset($library['rpm'])) {
echo '<li class="rpm package">rpm: ' . htmlentities($library['rpm']) . '</li>'; echo '<li class="rpm package">rpm: ' . htmlentities($library['rpm']) . '</li>';
} }
if ($library['pear']) { if (isset($library['pear'])) {
echo '<li class="pear package">pear: ' . htmlentities($library['pear']) . '</li>'; echo '<li class="pear package">pear: ' . htmlentities($library['pear']) . '</li>';
} }
echo '</ul>'; echo '</ul>';
@ -552,7 +552,7 @@ STR;
updateStatus("You can visit your <a href='$link'>new StatusNet site</a>."); updateStatus("You can visit your <a href='$link'>new StatusNet site</a>.");
} }
function Pgsql_Db_installer($host, $database, $username, $password) function Pgsql_Db_installer($host, $database, $username, $password)
{ {
$connstring = "dbname=$database host=$host user=$username"; $connstring = "dbname=$database host=$host user=$username";
@ -613,7 +613,7 @@ function Pgsql_Db_installer($host, $database, $username, $password)
return $db; return $db;
} }
function Mysql_Db_installer($host, $database, $username, $password) function Mysql_Db_installer($host, $database, $username, $password)
{ {
updateStatus("Starting installation..."); updateStatus("Starting installation...");
updateStatus("Checking database..."); updateStatus("Checking database...");
@ -690,7 +690,7 @@ function writeConf($sitename, $server, $path, $fancy, $db)
* @param string $filename location of database schema file * @param string $filename location of database schema file
* @param dbconn $conn connection to database * @param dbconn $conn connection to database
* @param string $type type of database, currently mysql or pgsql * @param string $type type of database, currently mysql or pgsql
* *
* @return boolean - indicating success or failure * @return boolean - indicating success or failure
*/ */
function runDbScript($filename, $conn, $type = 'mysqli') function runDbScript($filename, $conn, $type = 'mysqli')