コード例 #1
0
/**
 * 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 . "/");
            }
        }
    }
}
コード例 #2
0
ファイル: cleanup.php プロジェクト: kyroskoh/singapore-1
/**
 * 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 . "/");
            }
        }
    }
}
コード例 #3
0
ファイル: uninstall.php プロジェクト: kyroskoh/singapore-1
<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 &gt;&gt;</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":
コード例 #4
0
ファイル: init.php プロジェクト: hung5s/yap
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;
    }
}
コード例 #5
0
ファイル: Xpress.php プロジェクト: hung5s/yap
 /**
  * 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;
 }
コード例 #6
0
ファイル: Application.php プロジェクト: hung5s/yap
 /**
  * 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;
 }