コード例 #1
0
ファイル: common.php プロジェクト: gpawlik/suited-php-classes
/**
 * function that checks for files dir,
 * and also checks is it is writable
 */
function cos_check_files_dir()
{
    clearstatcache();
    $files_dir = conf::pathFilesBase() . "/files";
    $domain = conf::getMainIni('domain');
    $files_dir .= "/{$domain}";
    if (!is_writable($files_dir)) {
        echo "dir: {$files_dir} is not writeable<br />\n";
        $user = getenv('APACHE_RUN_USER');
        echo "server user is: {$user}<br />\n";
        echo "On unix solution will be to:<br />\n";
        echo "sudo chown -R www-data:www-data ./files";
        die;
    } else {
        echo "We can write to files dir.OK<br>";
    }
}
コード例 #2
0
 public function saveMp4($url)
 {
     $file = conf::pathFilesBase() . $url;
     if (!file_exists($file)) {
         return false;
     }
     return $file;
 }
コード例 #3
0
ファイル: assets.php プロジェクト: gpawlik/suited-php-classes
 /**
  * sets js as a single file in js-all file 
  */
 public static function setJsAsSingleFile()
 {
     $str = self::getJsAsSingleStr();
     $md5 = md5($str);
     $domain = conf::getDomain();
     $web_path = "/files/{$domain}/cached_assets";
     $file = "/js_all-{$md5}.js";
     $full_path = conf::pathFilesBase() . "/{$web_path}";
     $full_file_path = $full_path . $file;
     // create file if it does not exist
     if (!file_exists($full_file_path)) {
         file_put_contents($full_file_path, $str, LOCK_EX);
     }
     self::setJs($web_path . $file);
 }