Cannot load required extension: %s', $req);
+ $pass = false;
}
}
+ // Make sure we have at least one database module available
+ global $dbModules;
+ $missingExtensions = array();
+ foreach ($dbModules as $type => $info) {
+ if (!checkExtension($info['check_module'])) {
+ $missingExtensions[] = $info['check_module'];
+ }
+ }
+
+ if (count($missingExtensions) == count($dbModules)) {
+ $req = implode(', ', $missingExtensions);
+ printf('
Cannot find mysql or pgsql extension. You need one or the other.');
+ $pass = false;
+ }
- if (!is_writable(INSTALLDIR)) {
- ?>
Cannot write config file to:
-
On your server, try this command: chmod a+w
- Cannot write config file to: %s
', INSTALLDIR);
+ printf('
On your server, try this command: chmod a+w %s', INSTALLDIR);
+ $pass = false;
+ }
- if (!is_writable(INSTALLDIR.'/avatar/')) {
- ?>
Cannot write avatar directory: /avatar/
-
On your server, try this command: chmod a+w /avatar/
-
- $pass = false;
- }
+ // Check the subdirs used for file uploads
+ $fileSubdirs = array('avatar', 'background', 'file');
+ foreach ($fileSubdirs as $fileSubdir) {
+ $fileFullPath = INSTALLDIR."/$fileSubdir/";
+ if (!is_writable($fileFullPath)) {
+ printf('
Cannot write to %s directory: %s
', $fileSubdir, $fileFullPath);
+ printf('
On your server, try this command: chmod a+w %s
', $fileFullPath);
+ $pass = false;
+ }
+ }
- return $pass;
+ return $pass;
}
+/**
+ * Checks if a php extension is both installed and loaded
+ *
+ * @param string $name of extension to check
+ *
+ * @return boolean whether extension is installed and loaded
+ */
function checkExtension($name)
{
- if (!extension_loaded($name)) {
- if (!dl($name.'.so')) {
- return false;
+ if (extension_loaded($name)) {
+ return true;
+ } elseif (function_exists('dl') && ini_get('enable_dl') && !ini_get('safe_mode')) {
+ // dl will throw a fatal error if it's disabled or we're in safe mode.
+ // More fun, it may not even exist under some SAPIs in 5.3.0 or later...
+ $soname = $name . '.' . PHP_SHLIB_SUFFIX;
+ if (PHP_SHLIB_SUFFIX == 'dll') {
+ $soname = "php_" . $soname;
}
+ return @dl($soname);
+ } else {
+ return false;
}
- return true;
+}
+
+/**
+ * Show list of libraries
+ *
+ * @return void
+ */
+function showLibs()
+{
+ global $external_libraries;
+ $present_libraries=array();
+ $absent_libraries=array();
+ foreach ($external_libraries as $external_library) {
+ if (haveExternalLibrary($external_library)) {
+ $present_libraries[]=$external_library;
+ } else {
+ $absent_libraries[]=$external_library;
+ }
+ }
+ echo<<
+
StatusNet comes bundled with a number of libraries required for the application to work. However, it is best that you use PEAR or you distribution to manage
+ libraries instead, as they tend to provide security updates faster, and may offer improved performance.
+
On Debian based distributions, such as Ubuntu, use a package manager (such as "aptitude", "apt-get", and "synaptic") to install the package listed.
+
On RPM based distributions, such as Red Hat, Fedora, CentOS, Scientific Linux, Yellow Dog Linux and Oracle Enterprise Linux, use a package manager (such as "yum", "apt-rpm", and "up2date") to install the package listed.
+
On servers without a package manager (such as Windows), or if the library is not packaged for your distribution, you can use PHP's PEAR to install the library. Simply run "pear install <name>".
+
+
Absent Libraries
+
+E_O_T;
+ foreach ($absent_libraries as $library) {
+ echo '