本文整理汇总了PHP中Get::dir_size方法的典型用法代码示例。如果您正苦于以下问题:PHP Get::dir_size方法的具体用法?PHP Get::dir_size怎么用?PHP Get::dir_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Get
的用法示例。
在下文中一共展示了Get::dir_size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _scorm_deleteitem
function _scorm_deleteitem($idscorm_package, $idscorm_organization, $erasetrackcontent = FALSE)
{
/* remove items: based on organizations */
//$rs = sql_query("SELECT idscorm_organization FROM ".$prefix."_scorm_organizations WHERE idscorm_package=".$idscorm_package);
//while(list($idscorm_organization) = sql_fetch_row($rs)) {
if ($erasetrackcontent) {
// selected tracking remove
$rsItems = sql_query("SELECT idscorm_item FROM " . $GLOBALS['prefix_lms'] . "_scorm_items WHERE idscorm_organization=" . $idscorm_organization);
while (list($idscorm_item) = sql_fetch_row($rsItems)) {
sql_query("DELETE FROM " . $GLOBALS['prefix_lms'] . "_scorm_tracking WHERE idscorm_resource=" . $idscorm_item);
}
}
sql_query("DELETE FROM " . $GLOBALS['prefix_lms'] . "_scorm_items WHERE idscorm_organization=" . $idscorm_organization);
//}
/* remove organizations */
sql_query("DELETE FROM " . $GLOBALS['prefix_lms'] . "_scorm_organizations WHERE idscorm_organization=" . $idscorm_organization);
// detect if there are other organization in package
$rs = sql_query("SELECT idscorm_organization FROM " . $GLOBALS['prefix_lms'] . "_scorm_organizations WHERE idscorm_package=" . $idscorm_package);
if (mysql_num_rows($rs) == 0) {
$rs = sql_query("SELECT path FROM " . $GLOBALS['prefix_lms'] . "_scorm_package WHERE idscorm_package='" . (int) $idscorm_package . "'") or die(mysql_error());
list($path) = sql_fetch_row($rs);
$scopath = str_replace('\\', '/', $GLOBALS['where_files_relative'] . '/appLms/' . Get::sett('pathscorm'));
/* remove all zip directory */
if (file_exists($scopath . $path)) {
/* if is the only occurrence of path in db delete files */
$rs = sql_query("SELECT idscorm_package FROM " . $GLOBALS['prefix_lms'] . "_scorm_package" . " WHERE path = '" . $path . "'");
if (mysql_num_rows($rs) == 1) {
$size = Get::dir_size($scopath . $path);
require_once dirname(__FILE__) . '/scorm_utils.php';
// for del tree
delDirTree($scopath . $path);
if (isset($_SESSION['idCourse']) && defined("LMS")) {
$GLOBALS['course_descriptor']->subFileToUsedSpace(false, $size);
}
}
}
/* remove resources */
sql_query("DELETE FROM " . $GLOBALS['prefix_lms'] . "_scorm_resources WHERE idscorm_package=" . $idscorm_package);
/* remove packages */
sql_query("DELETE FROM " . $GLOBALS['prefix_lms'] . "_scorm_package WHERE idscorm_package=" . $idscorm_package);
}
}
示例2: exceed_quota
public static function exceed_quota($file_path, $quota, $used, $manual_file_size = false)
{
if ($quota == 0) {
return false;
}
$quota = $quota * 1024 * 1024;
if ($manual_file_size === false) {
$filesize = Get::dir_size($file_path);
} else {
$filesize = $manual_file_size;
}
return $used + $filesize > $quota;
}