/** * Checks to see if the SLIR error log exists and is writable. * * @since 2.0 * @return SLIRInstallerResponse */ private function initializeErrorLog() { $configClass = SLIR::getConfigClass(); if (!file_exists($configClass::$pathToErrorLog)) { // Error log does not exist, try creating it if (file_put_contents($configClass::$pathToErrorLog, '') === false) { // Error log was unable to be created return new NegativeSLIRInstallerResponse(sprintf('Error log does not exist and could not be created at <code>%s</code>. Please create this file and make sure the web server has permission to write to it. If you would like to change the path of this file, set $pathToErrorLog in slirconfig.class.php and run the installer again.', $configClass::$pathToErrorLog)); } else { // Everything worked well return new PositiveSLIRInstallerResponse(sprintf('Error log successfully created at <code>%s</code>. If you would like to change the path of this file, set $pathToErrorLog in slirconfig.class.php and run the installer again.', $configClass::$pathToErrorLog)); } } else { if (!is_writable($configClass::$pathToErrorLog)) { // Error log exists, but is not writable return new NegativeSLIRInstallerResponse(sprintf('Error log exists at <code>%s</code> but is not writable. Please make sure the web server has permission to write to this file. If you would like to change the path of this file, set $pathToErrorLog in slirconfig.class.php and run the installer again.', $configClass::$pathToErrorLog)); } else { // Everything is good return new PositiveSLIRInstallerResponse(sprintf('Error log exists at <code>%s</code> and is writable by the web server. If you would like to change the path of this file, set $pathToErrorLog in slirconfig.class.php and run the installer again.', $configClass::$pathToErrorLog)); } } }
/** * Removes the file that signifies that the garbage collector is currently running. * * @since 2.0 * @param boolean $successful * @return void */ private function finish($successful = true) { $configClass = SLIR::getConfigClass(); // Delete the file that tells SLIR that the garbage collector is running unlink($configClass::$pathToCacheDir . '/garbageCollector.tmp'); if ($successful) { error_log(sprintf("\n[%s] Garbage collection completed", @gmdate('D M d H:i:s Y')), 3, $configClass::$pathToErrorLog); } }
/** * @return string * @since 2.0 */ public final function fullPath() { $configClass = SLIR::getConfigClass(); return $configClass::$documentRoot . $this->path; }