예제 #1
0
 public static function write($content, $id, $type = 'article')
 {
     $file = self::getFileName($id, $type);
     if (!file_put_contents(dir::cache(self::FOLDER . DIRECTORY_SEPARATOR . $file), $content, LOCK_EX)) {
         return false;
     }
     return true;
 }
예제 #2
0
파일: cache.php 프로젝트: DINKIN/rokket
 public static function clear($folder = '')
 {
     if ($dir = opendir(dir::cache($folder))) {
         while (($file = readdir($dir)) !== false) {
             if (is_file($file)) {
                 self::deleteFile($file);
             }
         }
         closedir($dir);
     }
 }
예제 #3
0
<?php

$error = false;
$table = table::factory();
$table->addRow()->addCell(lang::get('type'))->addCell(lang::get('value'))->addCell(lang::get('status'));
$table->addSection('tbody');
$table->addRow()->addCell(lang::get('php_version'))->addCell('>5.4');
if (version_compare(phpversion(), '5.4', '<')) {
    $table->addCell('<span class="label label-danger">' . lang::get('php_version_54') . '</span>');
} else {
    $table->addCell('<span class="label label-success">' . lang::get('ok') . '</span>');
}
$writeable = [dir::cache(), dir::backend('addons' . DIRECTORY_SEPARATOR), dir::backend('lib' . DIRECTORY_SEPARATOR . 'config.json')];
function stripPath($file)
{
    return str_replace(dir::base(), '', $file);
}
foreach ($writeable as $file) {
    $table->addRow()->addCell(stripPath($file))->addCell('0755');
    if (is_file($file)) {
        if (is_writeable($file)) {
            $table->addCell('<span class="label label-success">' . lang::get('ok') . '</span>');
        } else {
            $table->addCell('<span class="label label-danger">' . lang::get('chmod_755') . '</span>');
            $error = true;
        }
    } elseif (is_dir($file)) {
        if (is_writeable($file)) {
            $table->addCell('<span class="label label-success">' . lang::get('ok') . '</span>');
        } else {
            $table->addCell('<span class="label label-danger">' . lang::get('chmod_755') . '</span>');