/** * Recursively attempts to make all files and directories in $dir writable * * @param string full directory name (must end with /) */ function makeWritable($dir) { if (is_dir($dir)) { $d = dir($dir); while (($file = $d->read()) !== false) { if ($file == '.' || $file == '..') { continue; } $fullfile = $d->path . $file; if (!is_writable($fullfile) && @chmod($fullfile, 0777)) { setupMessage("Made {$fullfile} writable"); } if (is_dir($fullfile)) { makeWritable($fullfile . "/"); } } } }
/** * Recursively attempts to make all files and directories in $dir writable * * @param string full directory name (must end with /) */ function makeWritable($dir) { if (is_dir($dir)) { $d = dir($dir); while (($file = $d->read()) !== false) { //ignore current and parent dirs and php files if ($file == '.' || $file == '..' || substr($file, strlen($file) - 4) == '.php') { continue; } $fullfile = $d->path . $file; if (@chmod($fullfile, 0777)) { echo "Made {$fullfile} writable.<br />"; } if (is_dir($fullfile)) { makeWritable($fullfile . "/"); } } } }
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>singapore setdown</title> <link rel="stylesheet" type="text/css" href="../docs/docstyle.css" /> </head> <body> <?php switch ($setupStep) { case "reset": setupHeader("Step 1 of 2: Reset permissions"); setupMessage("Resetting file permissions on server-generated content"); setupMessage("Nothing is deleted at this time"); makeWritable($basePath); setupHeader("OK"); setupMessage("This step completed successfully"); setupHeader("WARNING!"); setupMessage("The following step will delete all gallery, image and user information from the currently selected database. Gallery directories and image files will not be deleted but all extended information (e.g. name, artist, copyright etc.) will be irretrievably lost"); echo '<br /><a href="index.html">Finish</a>'; echo ' | <a href="uninstall.php?step=database">Next: I AM SURE I WANT TO delete database information >></a>'; break; case "database": setupHeader("Step 2 of 2: Delete database information"); //create config object $config = sgConfig::getInstance(); $config->loadConfig($basePath . "singapore.ini"); $config->base_path = $basePath; switch ($config->io_handler) { case "csv":
function checkYiiWritableFolders() { $check = true; $writables = array('assets' => 0); foreach ($writables as $folder => $errorCode) { if ((!is_dir(WEB_ROOT . $folder) || !file_exists(WEB_ROOT . $folder)) && !makeDir(WEB_ROOT . $folder)) { $writables[$folder] = -2; $check = false; } elseif (!is_writable(WEB_ROOT . $folder) && !makeWritable(WEB_ROOT . $folder)) { $writables[$folder] = -1; $check = false; } } if (!$check) { return $writables; } else { return true; } }
/** * Get path to cache folder for the current running workflow * * @param bool $global get the global cache (default is /runtime/cache) * * @return string */ public function getCachePath($global = false) { $globalPath = $this->globalCache; if ($global) { $return = WEB_ROOT . 'sites/' . SITE_DIR . '/protected/runtime' . '/' . $globalPath . '/'; makeWritable($return); } elseif ($this->workflowCachPath == null) { $return = WEB_ROOT . 'sites/' . SITE_DIR . '/protected/runtime' . '/' . $globalPath . '/' . WORKFLOW_ID . '/'; Yii::log('workflow cache path: ' . $return); $this->workflowCachPath = $return; makeWritable($return); } else { $return = $this->workflowCachPath; } return $return; }
/** * Get path to cache folder for the current running workflow * * @param bool $global get the global cache (default is /runtime/cache) * * @return string */ public static function getCachePath($global = false) { $globalPath = self::$globalCache; if ($global) { $return = WEB_ROOT . 'sites/' . SITE_DIR . '/protected/runtime' . '/' . $globalPath . '/'; makeWritable($return); } elseif (self::$workflowCachePath == null) { $return = WEB_ROOT . 'sites/' . SITE_DIR . '/protected/runtime' . '/' . $globalPath . '/' . WORKFLOW_ID . '/'; self::$workflowCachePath = $return; makeWritable($return); } else { $return = self::$workflowCachePath; } return $return; }