コード例 #1
0
 /**
  * Implementation Create Backup functionality for Filesystem
  *
  * @throws \Magento\Framework\Exception
  * @return boolean
  */
 public function create()
 {
     set_time_limit(0);
     ignore_user_abort(true);
     $this->_lastOperationSucceed = false;
     $this->_checkBackupsDir();
     $fsHelper = new \Magento\Framework\Backup\Filesystem\Helper();
     $filesInfo = $fsHelper->getInfo($this->getRootDir(), \Magento\Framework\Backup\Filesystem\Helper::INFO_READABLE | \Magento\Framework\Backup\Filesystem\Helper::INFO_SIZE, $this->getIgnorePaths());
     if (!$filesInfo['readable']) {
         throw new \Magento\Framework\Backup\Exception\NotEnoughPermissions('Not enough permissions to read files for backup');
     }
     $freeSpace = disk_free_space($this->getBackupsDir());
     if (2 * $filesInfo['size'] > $freeSpace) {
         throw new \Magento\Framework\Backup\Exception\NotEnoughFreeSpace('Not enough free space to create backup');
     }
     $tarTmpPath = $this->_getTarTmpPath();
     $tarPacker = new \Magento\Framework\Backup\Archive\Tar();
     $tarPacker->setSkipFiles($this->getIgnorePaths())->pack($this->getRootDir(), $tarTmpPath, true);
     if (!is_file($tarTmpPath) || filesize($tarTmpPath) == 0) {
         throw new \Magento\Framework\Exception('Failed to create backup');
     }
     $backupPath = $this->getBackupPath();
     $gzPacker = new \Magento\Framework\Archive\Gz();
     $gzPacker->pack($tarTmpPath, $backupPath);
     if (!is_file($backupPath) || filesize($backupPath) == 0) {
         throw new \Magento\Framework\Exception('Failed to create backup');
     }
     @unlink($tarTmpPath);
     $this->_lastOperationSucceed = true;
     return $this->_lastOperationSucceed;
 }
コード例 #2
0
ファイル: haarp.php プロジェクト: albertok/haarpcache
function disk_use($dir)
{
    $df = disk_free_space($dir);
    $dt = disk_total_space($dir);
    $du = $dt - $df;
    return $du / $dt * 100;
}
コード例 #3
0
ファイル: OpenBSD.php プロジェクト: Ali-Shaikh/linfo
 public function getMounts()
 {
     // Time?
     if (!empty($this->settings['timer'])) {
         $t = new Timer('Mounted file systems');
     }
     // Get result of mount command
     try {
         $mount_res = $this->exec->exec('mount');
     } catch (Exception $e) {
         Errors::add('Linfo Core', 'Error running `mount` command');
         return array();
     }
     // Match that up
     if (preg_match_all('/^(\\S+) on (\\S+) type (\\S+) \\(.+\\)$/m', $mount_res, $mount_matches, PREG_SET_ORDER) == 0) {
         return array();
     }
     // Store them here
     $mounts = array();
     // Go through
     foreach ($mount_matches as $mount) {
         // Should we not show this?
         if (in_array($mount[1], $this->settings['hide']['storage_devices']) || in_array($mount[3], $this->settings['hide']['filesystems'])) {
             continue;
         }
         // Get these
         $size = @disk_total_space($mount[2]);
         $free = @disk_free_space($mount[2]);
         $used = $size - $free;
         // Might be good, go for it
         $mounts[] = array('device' => $mount[1], 'mount' => $mount[2], 'type' => $mount[3], 'size' => $size, 'used' => $used, 'free' => $free, 'free_percent' => (bool) $free != false && (bool) $size != false ? round($free / $size, 2) * 100 : false, 'used_percent' => (bool) $used != false && (bool) $size != false ? round($used / $size, 2) * 100 : false);
     }
     // Give it
     return $mounts;
 }
コード例 #4
0
ファイル: _hdd.php プロジェクト: idoop/Raspcontrol
    function freeStorage()
    {
        $bytes = disk_free_space(".");
        $si_prefix = array('B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB');
        $base = 1024;
        $class = min((int) log($bytes, $base), count($si_prefix) - 1);
        $free = sprintf('%1.2f', $bytes / pow($base, $class));
        $bytes = disk_total_space(".");
        $si_prefix = array('B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB');
        $base = 1024;
        $class = min((int) log($bytes, $base), count($si_prefix) - 1);
        $total = sprintf('%1.2f', $bytes / pow($base, $class));
        $used = $total - $free;
        $percentage = round($used / $total * 100);
        if ($percentage > '80') {
            echo '
				<div style="float:left"><img src="app/images/sd.png" align="middle"> SD Card <font color="red"> (Warning)</font>:
				<br/><br/><div class="graph"><strong class="barGreen" style="width:' . $percentage . '%;">' . $percentage . '%</strong></div> &nbsp; &nbsp;  <div class="clear"></div>; ';
        } else {
            echo '
				 <div style="float:left"><img src="app/images/sd.png" align="middle"> SD Card <font color="green"> (OK)</font>:
				 <br/><div class="graph"><strong class="barGreen" style="width:' . $percentage . '%;">' . $percentage . '%</strong></div> &nbsp; &nbsp;  <div class="clear"></div>';
        }
        echo "<br/>Total: <strong>" . $total . "</strong> GB &middot ";
        echo "Free: <strong>" . $free . "</strong> GB";
        echo "</div>";
    }
コード例 #5
0
ファイル: log.Disk.php プロジェクト: javinc/loadavg
 /**
  * logDiskUsageData
  *
  * Retrives data and logs it to file
  *
  * @param string $type type of logging default set to normal but it can be API too.
  * @return string $string if type is API returns data as string
  *	 *
  */
 public function logData($type = false)
 {
     $class = __CLASS__;
     $settings = Logger::$_settings->{$class};
     $timestamp = time();
     $drive = $settings['settings']['drive'];
     if (is_dir($drive)) {
         $spaceBytes = disk_total_space($drive);
         $freeBytes = disk_free_space($drive);
         $usedBytes = $spaceBytes - $freeBytes;
         //$freeBytes = dataSize($Bytes);
         //$percentBytes = $freeBytes ? round($freeBytes / $totalBytes, 2) * 100 : 0;
     }
     $string = $timestamp . '|' . $usedBytes . '|' . $spaceBytes . "\n";
     $filename = sprintf($this->logfile, date('Y-m-d'));
     LoadUtility::safefilerewrite($filename, $string, "a", true);
     //If alerts are enabled, check for alerts
     if (Alert::$alertStatus) {
         $this->checkAlerts($timestamp, $usedBytes, $spaceBytes, $settings);
     }
     if ($type == "api") {
         return $string;
     } else {
         return true;
     }
 }
コード例 #6
0
 public function index()
 {
     //服务器信息
     $info = array('操作系统' => PHP_OS, '运行环境' => $_SERVER["SERVER_SOFTWARE"], 'PHP运行方式' => php_sapi_name(), 'MYSQL版本' => mysql_get_server_info(), '上传附件限制' => ini_get('upload_max_filesize'), '执行时间限制' => ini_get('max_execution_time') . "秒", '剩余空间' => round(@disk_free_space(".") / (1024 * 1024), 2) . 'M');
     $this->assign('server_info', $info);
     $this->display();
 }
コード例 #7
0
 public function index()
 {
     //服务器信息
     $info = array('操作系统' => PHP_OS, '运行环境' => $_SERVER["SERVER_SOFTWARE"], 'PHP运行方式' => php_sapi_name(), 'MYSQL版本' => mysql_get_server_info(), '85ZU版本' => ZU_VERSION . "&nbsp;&nbsp;&nbsp; [<a href='http://www.85zu.com' target='_blank'>访问官网</a>]", '上传附件限制' => ini_get('upload_max_filesize'), '执行时间限制' => ini_get('max_execution_time') . "秒", '剩余空间' => round(@disk_free_space(".") / (1024 * 1024 * 1024), 2) . 'G');
     $this->assign('server_info', $info);
     $this->display();
 }
コード例 #8
0
function widgetHardDrives() {
	global $drive;
	
	$warningthreshold = 90;
	
	if(empty($drive)) {
		echo "<table border=\"0\" id=\"harddrives\">\n";
		echo "\t<col id=\"col-disk\" />\n";
		echo "\t<col id=\"col-capacity\" />\n";
		echo "\t<col id=\"col-remaining\" />\n";
		echo "\t<col id=\"col-progress\" />\n";
		echo "\t<tr>\n";
		echo "\t\t<th>Disk</th>\n";
		echo "\t\t<th>Capacity</th>\n";
		echo "\t\t<th>Remaining</th>\n";
		echo "\t\t<th>%</th>\n";
		echo "\t</tr>\n";
		foreach( $drive as $drivelabel => $drivepath) {
			echo "\t<tr>\n";
			echo "\t\t<td>".$drivelabel."</td>\n";
			echo "\t\t<td>".to_readable_size(disk_total_space($drivepath))."</td>\n";
			echo "\t\t<td>".to_readable_size(disk_free_space($drivepath))."</td>\n";
			echo "\t\t<td><div class=\"progressbar\"><div class=\"progress".((disk_used_percentage($drivepath) > $warningthreshold) ? " warning" : "")."\" style=\"width:".(disk_used_percentage($drivepath))."%\"></div><div class=\"progresslabel\">".sprintf("%u", disk_used_percentage($drivepath))."%</div></div></td>\n";
			echo "\t</tr>\n";
		}
		echo "</table>\n";
	}
        else{
            echo 'You have not configured this feature in the config file yet.';

        }
}
コード例 #9
0
ファイル: frontend.php プロジェクト: StudsPro/islandpeeps.com
 public function index()
 {
     $_user = $this->uri->segment(1);
     if (isset($_user) && !empty($_user) && preg_match("/^[a-zA-Z0-9-_]+\$/", $_user)) {
         if (isset($this->session->userdata['frontlogin']) && $this->session->userdata['frontlogin'] == true && $this->session->userdata['frontuser'] == $_user) {
             $_details = $this->mFrontend->getDetailsbyURL($_user);
             if ($_details != false) {
                 $this->session->set_userdata('importUnique', uniqid('imp_', true));
                 $this->session->set_userdata('fileByCustomer', '1');
                 $errortype = isset($_GET['errortype']) ? $_GET['errortype'] : false;
                 $errormsg = isset($_GET['errormsg']) ? urldecode($_GET['errormsg']) : '';
                 $_data = array('title' => __('front_title_welcome'), 'site' => 'frontend/dashboard', 'user' => $_details, 'addnavi' => true, 'errortype' => $errortype, 'errormsg' => $errormsg, 'allowupload' => $_details->userCanUpload == '1' ? 'yes' : 'no', 'showfree' => $this->mGlobal->getConfig('SHOW_FREESPACE_USER')->configVal, 'diskfree' => disk_free_space(FCPATH), 'disktotal' => disk_total_space(FCPATH), 'folder' => isset($_details->defaultFolderID) && !is_null($_details->defaultFolderID) && !empty($_details->defaultFolderID) ? $_details->defaultFolderID : '');
                 if ($_details->userCanUpload == '1') {
                     $this->load->view('frontend', $_data);
                 } else {
                     redirect($_user . '/userfiles');
                 }
             } else {
                 redirect($_user . '/error');
             }
         } else {
             redirect($_user . '/login');
         }
     } else {
         if (mGlobal::getConfig('SHOW_CENTRAL_LOGIN')->configVal == 'yes') {
             redirect('login');
         }
         $_data = array('title' => __('front_title_welcome'), 'site' => 'frontend/index', 'header' => 'header', 'errtype' => false, 'errmsg' => '');
         $this->load->view('frontend', $_data);
     }
 }
 /**
  * @param srCertificate $certificate
  */
 public function __construct(srCertificate $certificate)
 {
     parent::__construct($certificate);
     $this->setEmail(ilSetting::_lookupValue('common', 'admin_email'));
     $this->setSubject($this->pl->txt('disk_space_warning_mail_subject'));
     $this->setBody(sprintf($this->pl->txt('disk_space_warning_mail_message'), disk_free_space($this->certificate->getCertificatePath())));
 }
コード例 #11
0
function processUpload($file, $username = null)
{
    if (!$username) {
        $username = fpCurrentUsername();
    }
    $tmpFile = $file["tmp_name"];
    $mimeType = $file["type"];
    $filename = utf8_decode($file["name"]);
    $filename = cleanupFilename($filename);
    $getcwd = getcwd();
    $freeSpace = disk_free_space("/");
    $uploaded = is_uploaded_file($tmpFile);
    $message = "OK";
    if (!$uploaded) {
        return errorMessage("Uploaded file not found.");
    }
    //verify file type
    if (!startsWith($mimeType, "image")) {
        return errorMessage("Uploaded file {$filename} is not an image. ({$mimeType})");
    }
    //move file to destination dir
    $dataRoot = getConfig("upload._diskPath");
    $dataRootUrl = getConfig("upload.baseUrl");
    createDir($dataRoot, $username);
    $uploadDir = combine($dataRoot, $username);
    $uploadedFile = combine($dataRoot, $username, $filename);
    $filesize = filesize($tmpFile);
    $success = move_uploaded_file($tmpFile, $uploadedFile);
    debug("move to {$uploadedFile}", $success);
    if (!$success) {
        return errorMessage("Cannot move file into target dir.");
    }
    return processImage($uploadDir, $filename);
}
コード例 #12
0
ファイル: MainAction.class.php プロジェクト: anywn3773/gzsrex
 public function main()
 {
     $db = D('');
     $db = DB::getInstance();
     $tables = $db->getTables();
     $info = array('license' => 'a', 'yourphp_VERSION' => '', 'SERVER_SOFTWARE' => PHP_OS . ' ' . $_SERVER["SERVER_SOFTWARE"], 'mysql_get_server_info' => php_sapi_name(), 'MYSQL_VERSION' => mysql_get_server_info(), 'upload_max_filesize' => ini_get('upload_max_filesize'), 'max_execution_time' => ini_get('max_execution_time') . L('miao'), 'disk_free_space' => round(@disk_free_space(".") / (1024 * 1024), 2) . 'M');
     $this->assign('server_info', $info);
     foreach ((array) $this->module as $rw) {
         if ($rw['type'] == 1) {
             $molule = M($rw['name']);
             $rw['counts'] = $molule->count();
             $mdata['moduledata'][] = $rw;
         }
     }
     $molule = M('User');
     $counts = $molule->count();
     $userinfos = $molule->find($_SESSION['adminid']);
     $mdata['moduledata'][] = array('title' => L('user_counts'), 'counts' => $counts);
     $molule = M('Category');
     $counts = $molule->count();
     $mdata['moduledata'][] = array('title' => L('Category_counts'), 'counts' => $counts);
     $this->assign($mdata);
     $role = F('Role');
     $userinfo = array('username' => $userinfos['username'], 'groupname' => $role[$userinfos['groupid']]['name'], 'logintime' => toDate($userinfos['last_logintime']), 'last_ip' => $userinfos['last_ip'], 'login_count' => $userinfos['login_count'] . L('ci'));
     $this->assign('userinfo', $userinfo);
     $this->display();
 }
コード例 #13
0
 /**
  * Reads the disk quota info
  *
  * @param integer $pow
  * @param integer $dec
  * @return array
  */
 public static function readDiskInfo($pow = 2, $dec = 2)
 {
     $diskInformation = array();
     if (function_exists('disk_free_space') && function_exists('disk_total_space')) {
         $root = '';
         if ($tmp = @disk_total_space($_SERVER["DOCUMENT_ROOT"])) {
             $root = $_SERVER["DOCUMENT_ROOT"];
         } else {
             $sql = "SELECT packageDir FROM wcf" . WCF_N . "_package\n            \t\t\tWHERE packageID = " . PACKAGE_ID;
             $row = WCF::getDB()->getFirstRow($sql);
             $root = FileUtil::getRealPath(WCF_DIR . $row['packageDir']);
         }
         if (!empty($root)) {
             $diskInformation['totalSpace'] = round(disk_total_space($root) / pow(1024, $pow), $dec);
             $diskInformation['freeSpace'] = round(disk_free_space($root) / pow(1024, $pow), $dec);
             $diskInformation['usedSpace'] = round($diskInformation['totalSpace'] - $diskInformation['freeSpace'], $dec);
             if ($diskInformation['totalSpace'] > 0) {
                 $diskInformation['freeQuota'] = round($diskInformation['freeSpace'] * 100 / $diskInformation['totalSpace'], $dec);
                 $diskInformation['usedQuota'] = round($diskInformation['usedSpace'] * 100 / $diskInformation['totalSpace'], $dec);
             } else {
                 $diskInformation['freeQuota'] = $diskInformation['usedQuota'] = 0;
             }
         }
     }
     return $diskInformation;
 }
コード例 #14
0
ファイル: class.OS_Minix.php プロジェクト: impelling/VegaDNS
 public function getMounts()
 {
     // Try using the `mount` command to get mounted file systems
     try {
         $res = $this->exec->exec('mount');
     } catch (CallExtException $e) {
         return array();
     }
     // Try matching up the output
     if (preg_match_all('/^(\\S+) is .+ mounted on (\\S+) \\(.+\\)$/m', $res, $mount_matches, PREG_SET_ORDER) == 0) {
         return array();
     }
     // Store them here
     $mounts = array();
     // Go through each match
     foreach ($mount_matches as $mount) {
         // These might be a waste
         $size = @disk_total_space($mount[2]);
         $free = @disk_free_space($mount[2]);
         $used = $size - $free;
         // Save it
         $mounts[] = array('device' => $mount[1], 'mount' => $mount[2], 'type' => '?', 'size' => $size, 'used' => $used, 'free' => $free, 'free_percent' => (bool) $free != false && (bool) $size != false ? round($free / $size, 2) * 100 : false, 'used_percent' => (bool) $used != false && (bool) $size != false ? round($used / $size, 2) * 100 : false);
     }
     // Return them
     return $mounts;
 }
コード例 #15
0
 public function main()
 {
     //$upyun_img = $this->createImgUpYun();
     $info = array('操作系统' => PHP_OS, '运行环境' => $_SERVER["SERVER_SOFTWARE"], 'PHP运行方式' => php_sapi_name(), '上传附件限制' => ini_get('upload_max_filesize'), '执行时间限制' => ini_get('max_execution_time') . '秒', '服务器时间' => date("Y年n月j日 H:i:s"), '北京时间' => gmdate("Y年n月j日 H:i:s", time() + 8 * 3600), '服务器域名/IP' => $_SERVER['SERVER_NAME'] . ' [ ' . gethostbyname($_SERVER['SERVER_NAME']) . ' ]', '服务器剩余空间' => round(disk_free_space(".") / (1024 * 1024), 2) . 'M', 'register_globals' => get_cfg_var("register_globals") == "1" ? "ON" : "OFF", 'magic_quotes_gpc' => 1 === get_magic_quotes_gpc() ? 'YES' : 'NO', 'magic_quotes_runtime' => 1 === get_magic_quotes_runtime() ? 'YES' : 'NO');
     $this->assign('info', $info);
     $this->display();
 }
コード例 #16
0
ファイル: System.php プロジェクト: BozzaCoon/SPHERE-Framework
 /**
  * @return Stage
  */
 public function frontendDashboard()
 {
     $Stage = new Stage('Dashboard', 'System');
     $Value = 100 / disk_total_space(__DIR__) * disk_free_space(__DIR__);
     Main::getDispatcher()->registerWidget('System', new Panel('Festplattenkapazität', array('<div class="progress" style="margin-bottom: 0;">
                       <div class="progress-bar progress-bar-success" style="width: ' . $Value . '%"></div>
                       <div class="progress-bar progress-bar-danger" style="width: ' . (100 - $Value) . '%"></div>
                     </div>', 'Gesamt: ' . number_format(disk_total_space(__DIR__), 0, ',', '.'), 'Frei: ' . number_format(disk_free_space(__DIR__), 0, ',', '.'))), 2, 2);
     $free = shell_exec('free');
     $free = (string) trim($free);
     $free_arr = explode("\n", $free);
     $mem = explode(" ", $free_arr[1]);
     $mem = array_filter($mem);
     $mem = array_merge($mem);
     $Value = $mem[2] / $mem[1] * 100;
     Main::getDispatcher()->registerWidget('System', new Panel('Speicherkapazität', array('<div class="progress" style="margin-bottom: 0;">
           <div class="progress-bar progress-bar-success" style="width: ' . $Value . '%"></div>
           <div class="progress-bar progress-bar-danger" style="width: ' . (100 - $Value) . '%"></div>
         </div>', 'Gesamt: ' . number_format($mem[1], 0, ',', '.'), 'Frei: ' . number_format($mem[2], 0, ',', '.'))), 2, 2);
     $load = sys_getloadavg();
     Main::getDispatcher()->registerWidget('System', new Panel('Rechenkapazität', array('<div class="progress" style="margin-bottom: 0;">
           <div class="progress-bar progress-bar-success" style="width: ' . 50 * (2 - $load[0]) . '%"></div>
           <div class="progress-bar progress-bar-danger" style="width: ' . 50 * $load[0] . '%"></div>
         </div>', 'Genutzt: ' . number_format($load[0], 5, ',', '.'), 'Frei: ' . number_format(2 - $load[0], 5, ',', '.'))), 2, 2);
     $Stage->setContent(Main::getDispatcher()->fetchDashboard('System'));
     return $Stage;
 }
コード例 #17
0
ファイル: comic-worker.php プロジェクト: guozanhua/bookspider
function Action($siteid, $bookid, $chapterid)
{
    global $basedir;
    global $task_count;
    $task_count++;
    print_r("Action[{$task_count}]: {$bookid}, {$chapterid}\n");
    $images = Download($siteid, $bookid, $chapterid);
    if (False === $images) {
        print_r("Download({$bookid}, {$chapterid}) failed.\n");
        return -1;
    }
    // write file
    $dir = "{$basedir}{$bookid}/{$chapterid}";
    if (!is_dir($dir)) {
        mkdir($dir, 0777, true);
    }
    $mb = 200 * 1024 * 1024;
    // 200MB
    if (disk_free_space($dir) < $mb) {
        print_r("disk full({$mb})\n");
        die;
    }
    $i = 0;
    foreach ($images as $image) {
        $filename = sprintf("{$dir}/%d.jpg", ++$i);
        file_put_contents($filename, $image);
    }
    sleep(10);
    return 0;
}
コード例 #18
0
ファイル: IndexAction.class.php プロジェクト: fkssei/pigcms10
 public function main()
 {
     $server_info = array('运行环境' => PHP_OS . ' ' . $_SERVER["SERVER_SOFTWARE"], 'PHP运行方式' => php_sapi_name(), 'MYSQL版本' => mysql_get_client_info(), '上传附件限制' => ini_get('upload_max_filesize'), '执行时间限制' => ini_get('max_execution_time') . '秒', '磁盘剩余空间 ' => round(@disk_free_space(".") / (1024 * 1024), 2) . 'M');
     $this->assign('server_info', $server_info);
     //用户总数
     $user = M('User');
     $website_user_count = $user->count('uid');
     //商户总数
     $website_merchant_count = $user->where(array('is_seller' => 1))->count('uid');
     //店铺总数
     $store = M('Store');
     $website_merchant_store_count = $store->count('store_id');
     //订单总数
     $order = M('Order');
     $website_merchant_order_count = $order->count('order_id');
     //商品数
     $product = M('Product');
     $website_merchant_goods_count = $product->count('product_id');
     //昨日新增用户
     $where = array();
     $date = date('Y-m-d', strtotime('-1 day'));
     $start_time = $date . ' 00:00:00';
     $end_time = $date . ' 23:59:59';
     $where['_string'] = "reg_time >= '" . strtotime($start_time) . "' AND reg_time <= '" . strtotime($end_time) . "'";
     $yesterday_add_user_count = $user->where($where)->count('uid');
     //昨日新增店铺
     $where = array();
     $where['_string'] = "date_added >= '" . strtotime($start_time) . "' AND date_added <= '" . strtotime($end_time) . "'";
     $yesterday_add_store_count = $user->where($where)->count('uid');
     //未付款订单
     $not_paid_order_count = $order->where(array('status' => 1))->count('order_id');
     //未发货订单
     $not_send_order_count = $order->where(array('status' => 2))->count('order_id');
     //已发货订单
     $send_order_count = $order->where(array('status' => 3))->count('order_id');
     //昨日新增订单
     $where = array();
     $where['_string'] = "add_time >= '" . strtotime($start_time) . "' AND add_time <= '" . strtotime($end_time) . "'";
     $yesterday_ordered_count = $order->where($where)->count('order_id');
     //上架商品
     $selling_product_count = $product->where(array('status' => 1))->count('product_id');
     //昨日新增商品
     $where = array();
     $where['_string'] = "date_added >= '" . strtotime($start_time) . "' AND date_added <= '" . strtotime($end_time) . "'";
     $yesterday_add_product_count = $product->where($where)->count('product_id');
     $this->assign('website_user_count', $website_user_count);
     $this->assign('website_merchant_count', $website_merchant_count);
     $this->assign('website_merchant_store_count', $website_merchant_store_count);
     $this->assign('website_merchant_order_count', $website_merchant_order_count);
     $this->assign('website_merchant_goods_count', $website_merchant_goods_count);
     $this->assign('yesterday_add_user_count', $yesterday_add_user_count);
     $this->assign('yesterday_add_store_count', $yesterday_add_store_count);
     $this->assign('not_paid_order_count', $not_paid_order_count);
     $this->assign('not_send_order_count', $not_send_order_count);
     $this->assign('send_order_count', $send_order_count);
     $this->assign('yesterday_ordered_count', $yesterday_ordered_count);
     $this->assign('selling_product_count', $selling_product_count);
     $this->assign('yesterday_add_product_count', $yesterday_add_product_count);
     $this->display();
 }
コード例 #19
0
ファイル: function.php プロジェクト: chenpusn/haozhixian_bak
/**
 * 系统环境检测
 * @return array 系统环境数据
 */
function check_env()
{
    $items = array('os' => array('操作系统', '不限制', '类Unix', PHP_OS, 'success'), 'php' => array('PHP版本', '5.3', '5.3+', PHP_VERSION, 'success'), 'upload' => array('附件上传', '不限制', '2M+', '未知', 'success'), 'gd' => array('GD库', '2.0', '2.0+', '未知', 'success'), 'disk' => array('磁盘空间', '5M', '不限制', '未知', 'success'));
    //PHP环境检测
    if ($items['php'][3] < $items['php'][1]) {
        $items['php'][4] = 'error';
        session('error', true);
    }
    //附件上传检测
    if (@ini_get('file_uploads')) {
        $items['upload'][3] = ini_get('upload_max_filesize');
    }
    //GD库检测
    $tmp = function_exists('gd_info') ? gd_info() : array();
    if (empty($tmp['GD Version'])) {
        $items['gd'][3] = '未安装';
        $items['gd'][4] = 'error';
        session('error', true);
    } else {
        $items['gd'][3] = $tmp['GD Version'];
    }
    unset($tmp);
    //磁盘空间检测
    if (function_exists('disk_free_space')) {
        $items['disk'][3] = floor(disk_free_space(INSTALL_APP_PATH) / (1024 * 1024)) . 'M';
    }
    return $items;
}
コード例 #20
0
function widgetHardDrives()
{
    global $drive;
    $warningthreshold = 90;
    if (!empty($drive)) {
        echo "<table border=\"0\" id=\"harddrives\">\n";
        echo "\t<col id=\"col-disk\" />\n";
        echo "\t<col id=\"col-capacity\" />\n";
        echo "\t<col id=\"col-remaining\" />\n";
        echo "\t<col id=\"col-progress\" />\n";
        echo "\t<tr>\n";
        echo "\t\t<th>Disk</th>\n";
        echo "\t\t<th>Size</th>\n";
        echo "\t\t<th>Free</th>\n";
        echo "\t\t<th>Usage</th>\n";
        echo "\t</tr>\n";
        foreach ($drive as $drivelabel => $drivepath) {
            echo "\t<tr>\n";
            echo "\t\t<td>" . $drivelabel . "</td>\n";
            echo "\t\t<td>" . to_readable_size(disk_total_space($drivepath)) . "</td>\n";
            echo "\t\t<td>" . to_readable_size(disk_free_space($drivepath)) . "</td>\n";
            echo "\t\t<td><div class=\"progressbar\"><div class=\"progress" . (disk_used_percentage($drivepath) > $warningthreshold ? " warning" : "") . "\" style=\"width:" . disk_used_percentage($drivepath) . "%\"></div><div class=\"progresslabel\">" . sprintf("%u", disk_used_percentage($drivepath)) . "%</div></div></td>\n";
            echo "\t</tr>\n";
        }
        echo "</table>\n";
    }
}
コード例 #21
0
ファイル: function.php プロジェクト: VampireMe/corethink
/**
 * 系统环境检测
 * @return array 系统环境数据
 * @author jry <*****@*****.**>
 */
function check_env()
{
    $items = array('os' => array('title' => '操作系统', 'limit' => '不限制', 'current' => PHP_OS, 'icon' => 'glyphicon-ok text-success'), 'php' => array('title' => 'PHP版本', 'limit' => '5.3+', 'current' => PHP_VERSION, 'icon' => 'glyphicon-ok text-success'), 'upload' => array('title' => '附件上传', 'limit' => '不限制', 'current' => ini_get('file_uploads') ? ini_get('upload_max_filesize') : '未知', 'icon' => 'glyphicon-ok text-success'), 'gd' => array('title' => 'GD库', 'limit' => '2.0+', 'current' => '未知', 'icon' => 'glyphicon-ok text-success'), 'disk' => array('title' => '磁盘空间', 'limit' => '100M+', 'current' => '未知', 'icon' => 'glyphicon-ok text-success'));
    //PHP环境检测
    if ($items['php']['current'] < 5.3) {
        $items['php']['icon'] = 'glyphicon-remove text-danger';
        session('error', true);
    }
    //GD库检测
    $tmp = function_exists('gd_info') ? gd_info() : array();
    if (!$tmp['GD Version']) {
        $items['gd']['current'] = '未安装';
        $items['gd']['icon'] = 'glyphicon-remove text-danger';
        session('error', true);
    } else {
        $items['gd']['current'] = $tmp['GD Version'];
    }
    unset($tmp);
    //磁盘空间检测
    if (function_exists('disk_free_space')) {
        $disk_size = floor(disk_free_space('./') / (1024 * 1024)) . 'M';
        $items['disk']['current'] = $disk_size . 'MB';
        if ($disk_size < 100) {
            $items['disk']['icon'] = 'glyphicon-remove text-danger';
            session('error', true);
        }
    }
    return $items;
}
コード例 #22
0
ファイル: file.class.php プロジェクト: kellenqian/axion
 public function set($key, $value, $expire = '')
 {
     $freeSpace = disk_free_space($this->config['path']);
     $freeSpaceMB = $freeSpace ? floor($freeSpace / 1024 / 1024) : 0;
     if ($freeSpaceMB < 10) {
         Axion_log::getinstance()->newMessage('磁盘容量过小,无法存储数据缓存文件', AXION_LOG::WARNING);
         return false;
     }
     $hash = md5($key);
     $expire = $expire ? $expire : $this->config['expire'];
     $expire = sprintf('%09d', $expire);
     $data = serialize($value);
     self::$_data[$hash] = $data;
     if (!is_dir($this->config['path'])) {
         if (!AXION_UTIL_FILE::mkdir($this->config['path'])) {
             throw new AXION_EXCEPTION('无法创建Cache文件目录:' . $this->config['path']);
         }
     }
     $fileName = $this->genFileName($key);
     if (IS_SHM && function_exists('gzcompress')) {
         $data = gzcompress($data, 4);
     }
     $data = $expire . $data;
     $result = file_put_contents($fileName, $data);
     if ($result) {
         clearstatcache();
         return true;
     } else {
         return false;
     }
 }
コード例 #23
0
 public function main()
 {
     $count = array();
     $article = M('article');
     $type = M('type');
     $link = M('link');
     $hd = M('flash');
     $ping = M('pl');
     $guest = M('guestbook');
     $count['article'] = $article->count();
     //文章总数
     $count['narticle'] = $article->where('status=0')->count();
     //未审核文章总数
     $count['guestbook'] = $guest->count();
     //留言总数
     $count['nguestbook'] = $guest->where('status=0')->count();
     //未审核留言总数
     $count['type'] = $type->count();
     //栏目总数
     $count['link'] = $link->count();
     //链接总数
     $count['hd'] = $hd->count();
     //幻灯总数
     $count['ping'] = $ping->count();
     //评论总数
     $count['nping'] = $ping->where('status=0')->count();
     //未审核评论
     $this->assign('count', $count);
     unset($article, $type, $link, $hd, $ping, $guest);
     $info = array('操作系统' => PHP_OS, '运行环境' => $_SERVER["SERVER_SOFTWARE"], 'PHP运行方式' => php_sapi_name(), '上传附件限制' => ini_get('upload_max_filesize'), '执行时间限制' => ini_get('max_execution_time') . '秒', '服务器时间' => date("Y年n月j日 H:i:s"), '北京时间' => gmdate("Y年n月j日 H:i:s", time() + 8 * 3600), '服务器域名/IP' => $_SERVER['SERVER_NAME'] . ' [ ' . gethostbyname($_SERVER['SERVER_NAME']) . ' ]', '剩余空间' => round(@disk_free_space(".") / (1024 * 1024), 2) . 'M', 'register_globals' => get_cfg_var("register_globals") == "1" ? "ON" : "OFF", 'magic_quotes_gpc' => 1 === get_magic_quotes_gpc() ? 'YES' : 'NO', 'magic_quotes_runtime' => 1 === get_magic_quotes_runtime() ? 'YES' : 'NO');
     $this->assign('info', $info);
     $this->display('main');
 }
コード例 #24
0
 public function main()
 {
     $info = array('操作系统' => PHP_OS, '运行环境' => $_SERVER["SERVER_SOFTWARE"], 'PHP运行方式' => php_sapi_name(), 'ThinkPHP版本' => THINK_VERSION . ' [ <a href="http://thinkphp.cn" target="_blank">查看最新版本</a> ]', '上传附件限制' => ini_get('upload_max_filesize'), '执行时间限制' => ini_get('max_execution_time') . '秒', '服务器时间' => date("Y年n月j日 H:i:s"), '北京时间' => gmdate("Y年n月j日 H:i:s", time() + 8 * 3600), '服务器域名/IP' => $_SERVER['SERVER_NAME'] . ' [ ' . gethostbyname($_SERVER['SERVER_NAME']) . ' ]', '剩余空间' => round(@disk_free_space(".") / (1024 * 1024), 2) . 'M', 'register_globals' => get_cfg_var("register_globals") == "1" ? "ON" : "OFF", 'magic_quotes_gpc' => 1 === get_magic_quotes_gpc() ? 'YES' : 'NO', 'magic_quotes_runtime' => 1 === get_magic_quotes_runtime() ? 'YES' : 'NO');
     $this->assign('info1', $info);
     // dump($info);
     $this->display();
 }
コード例 #25
0
 public function collect()
 {
     $this->collected[] = (new Serie(NULL, $this->hostname, $this->name, "total", "Free", disk_free_space('/')))->getArray();
     $this->collected[] = (new Serie(NULL, $this->hostname, $this->name, "total", "InUse", disk_total_space('/') - disk_free_space('/')))->getArray();
     if (!is_array($this->keysConfig)) {
         return true;
     }
     $n = 0;
     foreach ($this->keysConfig as $path => $isActive) {
         if ($isActive == 0) {
             continue;
         }
         $file_wait = TMP_FOLDER . DIRECTORY_SEPARATOR . 'saturn.disk_' . $n . '.work.wait';
         $file_complete = TMP_FOLDER . DIRECTORY_SEPARATOR . 'saturn.disk_' . $n . '.work.complete';
         if (file_exists($file_complete)) {
             //self::log( $path . " END" . $file_complete );
             $content = file_get_contents($file_complete);
             //self::log( $path . " CONTENT " . $content );
             if (preg_match('/([0-9]+)/', $content, $match)) {
                 $size = $match[1];
                 //self::log( $path . " SIZE " . $size );
                 $this->collected[] = (new Serie(NULL, $this->hostname, $this->name, "path", $path, $size))->getArray();
             }
             @unlink($file_complete);
             @unlink($file_wait);
         }
         if (!file_exists($file_wait)) {
             exec('du -s ' . $path . ' > ' . $file_complete . " &");
             touch($file_wait);
         }
         $n++;
     }
 }
コード例 #26
0
function Action($bookid, $chapterid)
{
    global $basedir;
    global $task_count;
    $task_count++;
    print_r("Action[{$task_count}]: {$bookid}, {$chapterid}\n");
    $audio = Download($bookid, $chapterid);
    if (0 == strlen($audio)) {
        print_r("Download({$bookid}, {$chapterid}) failed.\n");
        return -1;
    }
    // write file
    $dir = "{$basedir}{$bookid}";
    if (!is_dir($dir)) {
        mkdir($dir, 0777, true);
    }
    $mb = 200 * 1024 * 1024;
    // 200MB
    if (disk_free_space($dir) < $mb) {
        print_r("disk full({$mb})\n");
        die;
    }
    $filename = sprintf("{$dir}/%d.mp3", $chapterid);
    file_put_contents($filename, $audio);
    return 0;
}
コード例 #27
0
/**
 * ============================================================================
 * WSTMall开源商城
 * 官网地址:http://www.wstmall.com 
 * 联系QQ:707563272
 * ============================================================================
 */
function env_check(&$env_items)
{
    foreach ($env_items as $key => $item) {
        $env_items[$key]['status'] = 1;
        if ($key == 'os') {
            $env_items[$key]['current'] = PHP_OS;
        } elseif ($key == 'php') {
            $env_items[$key]['current'] = PHP_VERSION;
        } elseif ($key == 'attachmentupload') {
            if (@ini_get('file_uploads')) {
                $env_items[$key]['current'] = ini_get('upload_max_filesize');
            } else {
                $env_items[$key]['status'] = -1;
                $env_items[$key]['current'] = '没有开启文件上传';
            }
        } elseif ($key == 'gdversion') {
            if (extension_loaded('gd')) {
                $tmp = gd_info();
                $env_items[$key]['current'] = empty($tmp['GD Version']) ? '' : $tmp['GD Version'];
                unset($tmp);
            } else {
                $env_items[$key]['current'] = "没有开启GD扩展";
                $env_items[$key]['status'] = -1;
            }
        } elseif ($key == 'diskspace') {
            if (function_exists('disk_free_space')) {
                $env_items[$key]['current'] = floor(disk_free_space(INSTALL_ROOT) / (1024 * 1024)) . 'M';
            } else {
                $env_items[$key]['current'] = '未知的磁盘空间';
                $env_items[$key]['status'] = 0;
            }
        }
    }
    return $env_items;
}
コード例 #28
0
ファイル: footer.php プロジェクト: BACKUPLIB/mwenhanced
/**
 * @version $Id: footer.php 107 2008-07-22 17:27:12Z soeren $
 * @package eXtplorer
 * @copyright soeren 2007
 * @author The eXtplorer project (http://sourceforge.net/projects/extplorer)
 * @author The  The QuiX project (http://quixplorer.sourceforge.net)
 * 
 * @license
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 * 
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 * 
 * Alternatively, the contents of this file may be used under the terms
 * of the GNU General Public License Version 2 or later (the "GPL"), in
 * which case the provisions of the GPL are applicable instead of
 * those above. If you wish to allow use of your version of this file only
 * under the terms of the GPL and not to allow others to use
 * your version of this file under the MPL, indicate your decision by
 * deleting  the provisions above and replace  them with the notice and
 * other provisions required by the GPL.  If you do not delete
 * the provisions above, a recipient may use your version of this file
 * under either the MPL or the GPL."
 * 
 * Shows the About Box!
 */
function show_about()
{
    // footer for html-page
    echo "\n<div id=\"ext_footer\" style=\"text-align:center;\">\r\n\t<img src=\"" . _EXT_URL . "/images/MangosWeb_small.png\" align=\"middle\" alt=\"Mangosweb Enhanced Logo\" />\r\n\t<br />\r\n\t" . ext_Lang::msg('your_version') . ": <a href=\"" . $GLOBALS['ext_home'] . "\" target=\"_blank\">eXtplorer {$GLOBALS['ext_version']}</a>\r\n\t<br />\r\n (<a href=\"http://virtuemart.net/index2.php?option=com_versions&amp;catid=5&amp;myVersion=" . $GLOBALS['ext_version'] . "\" onclick=\"javascript:void window.open('http://virtuemart.net/index2.php?option=com_versions&catid=5&myVersion=" . $GLOBALS['ext_version'] . "', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=580,directories=no,location=no'); return false;\" title=\"" . $GLOBALS["messages"]["check_version"] . "\">" . $GLOBALS["messages"]["check_version"] . "</a>)\r\n\t\r\n\t";
    if (function_exists("disk_free_space")) {
        $size = disk_free_space($GLOBALS['home_dir'] . $GLOBALS['separator']);
        $free = parse_file_size($size);
    } elseif (function_exists("diskfreespace")) {
        $size = diskfreespace($GLOBALS['home_dir'] . $GLOBALS['separator']);
        $free = parse_file_size($size);
    } else {
        $free = "?";
    }
    echo '<br />' . $GLOBALS["messages"]["miscfree"] . ": " . $free . " \n";
    if (extension_loaded("posix")) {
        $owner_info = '<br /><br />' . ext_Lang::msg('current_user') . ' ';
        if (ext_isFTPMode()) {
            $my_user_info = posix_getpwnam($_SESSION['ftp_login']);
            $my_group_info = posix_getgrgid($my_user_info['gid']);
        } else {
            $my_user_info = posix_getpwuid(posix_geteuid());
            $my_group_info = posix_getgrgid(posix_getegid());
        }
        $owner_info .= $my_user_info['name'] . ' (' . $my_user_info['uid'] . '), ' . $my_group_info['name'] . ' (' . $my_group_info['gid'] . ')';
        echo $owner_info;
    }
    echo "\r\n\t</div>";
}
コード例 #29
0
ファイル: Cache.php プロジェクト: AppChecker/composer
 public function write($file, $contents)
 {
     if ($this->enabled) {
         $file = preg_replace('{[^' . $this->whitelist . ']}i', '-', $file);
         if ($this->io->isDebug()) {
             $this->io->writeError('Writing ' . $this->root . $file . ' into cache');
         }
         try {
             return file_put_contents($this->root . $file, $contents);
         } catch (\ErrorException $e) {
             if ($this->io->isDebug()) {
                 $this->io->writeError('<warning>Failed to write into cache: ' . $e->getMessage() . '</warning>');
             }
             if (preg_match('{^file_put_contents\\(\\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
                 // Remove partial file.
                 unlink($this->root . $file);
                 $message = sprintf('<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$u bytes of free space available</warning>', $this->root . $file, $m[1], $m[2], @disk_free_space($this->root . dirname($file)));
                 $this->io->writeError($message);
                 return false;
             }
             throw $e;
         }
     }
     return false;
 }
コード例 #30
0
 public function index()
 {
     //服务器信息
     $info = array('操作系统' => PHP_OS, '运行环境' => $_SERVER["SERVER_SOFTWARE"], 'PHP运行方式' => php_sapi_name(), 'MYSQL版本' => mysql_get_server_info(), '产品名称' => '<font color="#FF0000">' . SHUIPF_APPNAME . '</font>' . "&nbsp;&nbsp;&nbsp; [<a href='http://www.shuipfcms.com' target='_blank'>访问官网</a>]", '用户类型' => '<font color="#FF0000" id="server_license">获取中...</font>', '产品版本' => '<font color="#FF0000">' . SHUIPF_VERSION . '</font>,最新版本:<font id="server_version">获取中...</font>', '产品流水号' => '<font color="#FF0000">' . SHUIPF_BUILD . '</font>,最新流水号:<font id="server_build">获取中...</font>', '上传附件限制' => ini_get('upload_max_filesize'), '执行时间限制' => ini_get('max_execution_time') . "秒", '剩余空间' => round(@disk_free_space(".") / (1024 * 1024), 2) . 'M');
     $this->assign('server_info', $info);
     $this->display();
 }