当前位置: 首页>>代码示例>>PHP>>正文


PHP bx_rrmdir函数代码示例

本文整理汇总了PHP中bx_rrmdir函数的典型用法代码示例。如果您正苦于以下问题:PHP bx_rrmdir函数的具体用法?PHP bx_rrmdir怎么用?PHP bx_rrmdir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bx_rrmdir函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: bx_rrmdir

 function bx_rrmdir($directory)
 {
     if (substr($directory, -1) == "/") {
         $directory = substr($directory, 0, -1);
     }
     if (!file_exists($directory) || !is_dir($directory)) {
         return false;
     } elseif (!is_readable($directory)) {
         return false;
     }
     if (!($directoryHandle = opendir($directory))) {
         return false;
     }
     while ($contents = readdir($directoryHandle)) {
         if ($contents != '.' && $contents != '..') {
             $path = $directory . "/" . $contents;
             if (is_dir($path)) {
                 bx_rrmdir($path);
             } else {
                 unlink($path);
             }
         }
     }
     closedir($directoryHandle);
     if (!rmdir($directory)) {
         return false;
     }
     return true;
 }
开发者ID:Prashank25,项目名称:dolphin.pro,代码行数:29,代码来源:delete_unused_files.php

示例2: cleanTmpFolders

 /**
  * Clean tmp folders (tmp, cache) by deleting old files (by default older than 1 month)
  */
 protected function cleanTmpFolders()
 {
     $iTmpFileLife = 2592000;
     // one month
     $aDirsToClean = array(BX_DIRECTORY_PATH_TMP, BX_DIRECTORY_PATH_CACHE, BX_DIRECTORY_PATH_CACHE_PUBLIC);
     $iNumTmp = 0;
     $iNumDel = 0;
     foreach ($aDirsToClean as $sDir) {
         if (!($h = opendir($sDir))) {
             continue;
         }
         while ($sFile = readdir($h)) {
             if ('.' == $sFile || '..' == $sFile || '.' == $sFile[0]) {
                 continue;
             }
             ++$iNumTmp;
             $iDiff = time() - filemtime($sDir . $sFile);
             if ($iDiff < $iTmpFileLife) {
                 continue;
             }
             if (is_file($sDir . $sFile)) {
                 @unlink($sDir . $sFile);
             } else {
                 @bx_rrmdir($sDir . $sFile);
             }
             ++$iNumDel;
         }
         closedir($h);
     }
     echo _t('_sys_pruning_files', $iNumTmp, $iNumDel);
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:34,代码来源:BxDolCronPruning.php

示例3: processing

 public function processing()
 {
     $oController = new BxDolUpgradeController();
     if ($oController->setMaintenanceMode(true)) {
         // if upgrade was successful
         if (($sFolder = $oController->getAvailableUpgrade()) && $oController->runUpgrade($sFolder)) {
             // write upgrade log
             $oController->writeLog();
             // send email notification
             bx_import('BxDolLanguages');
             sendMailTemplateSystem('t_UpgradeSuccess', array('new_version' => bx_get_ver(true), 'conclusion' => $oController->getConclusion() ? _t('_sys_upgrade_conclusion', $oController->getConclusion()) : ''));
             // if next upgrade is available (in case of bulk upgrade) then schedule to run it upon next cron run
             $sUpgradeDir = pathinfo(__FILE__, PATHINFO_DIRNAME);
             if ($oController->getAvailableUpgrade()) {
                 $oUpgrader = bx_instance('BxDolUpgrader');
                 $oUpgrader->setTransientUpgradeCronJob($sUpgradeDir);
             } elseif (0 === strpos($sUpgradeDir, BX_DIRECTORY_PATH_TMP)) {
                 @bx_rrmdir($sUpgradeDir);
             }
         }
         $oController->setMaintenanceMode(false);
     }
     // if something went grong during upgrade
     if ($sErrorMsg = $oController->getErrorMsg()) {
         // write upgrade log
         $oController->writeLog();
         // send email notification
         sendMailTemplateSystem('t_UpgradeFailed', array('error_msg' => $sErrorMsg));
         // disable auto-upgrade if it is failed
         setParam('sys_autoupdate_system', '');
     }
 }
开发者ID:Baloo7super,项目名称:dolphin,代码行数:32,代码来源:BxDolUpgradeCron.php

示例4: downloadUpdate

 function downloadUpdate($sLink)
 {
     $sName = mktime() . '.zip';
     $sData = bx_file_get_contents($sLink);
     //--- write ZIP archive.
     $sTmpPath = BX_DIRECTORY_PATH_ROOT . 'tmp/';
     $sFilePath = $sTmpPath . $sName;
     if (!($rHandler = fopen($sFilePath, 'w'))) {
         return _t('_adm_txt_modules_cannot_download_package');
     }
     if (!fwrite($rHandler, $sData)) {
         return _t('_adm_txt_modules_cannot_write_package');
     }
     fclose($rHandler);
     //--- Unarchive package.
     if (!class_exists('ZipArchive')) {
         return _t('_adm_txt_modules_zip_not_available');
     }
     $oZip = new ZipArchive();
     if ($oZip->open($sFilePath) !== true) {
         return _t('_adm_txt_modules_cannot_unzip_package');
     }
     $sPackageRootFolder = $oZip->numFiles > 0 ? $oZip->getNameIndex(0) : false;
     if ($sPackageRootFolder && file_exists($sTmpPath . $sPackageRootFolder)) {
         // remove existing tmp folder with the same name
         bx_rrmdir($sTmpPath . $sPackageRootFolder);
     }
     if ($sPackageRootFolder && !$oZip->extractTo($sTmpPath)) {
         return _t('_adm_txt_modules_cannot_unzip_package');
     }
     $oZip->close();
     //--- Move unarchived package.
     $sLogin = getParam('sys_ftp_login');
     $sPassword = getParam('sys_ftp_password');
     $sPath = getParam('sys_ftp_dir');
     if (empty($sLogin) || empty($sPassword) || empty($sPath)) {
         return _t('_adm_txt_modules_no_ftp_info');
     }
     bx_import('BxDolFtp');
     $oFtp = new BxDolFtp($_SERVER['HTTP_HOST'], $sLogin, $sPassword, $sPath);
     if (!$oFtp->connect()) {
         return _t('_adm_txt_modules_cannot_connect_to_ftp');
     }
     if (!$oFtp->isDolphin()) {
         return _t('_adm_txt_modules_destination_not_valid');
     }
     $sConfigPath = $sTmpPath . $sPackageRootFolder . '/install/config.php';
     if (!file_exists($sConfigPath)) {
         return _t('_adm_txt_modules_wrong_package_format');
     }
     include $sConfigPath;
     if (empty($aConfig) || empty($aConfig['home_dir']) || !$oFtp->copy($sTmpPath . $sPackageRootFolder . '/', 'modules/' . $aConfig['home_dir'])) {
         return _t('_adm_txt_modules_ftp_copy_failed');
     }
     return true;
 }
开发者ID:Gotgot59,项目名称:dolphin.pro,代码行数:56,代码来源:BxDolInstallerUi.php

示例5: profile_delete

function profile_delete($ID, $isDeleteSpammer = false)
{
    //global $MySQL;
    global $dir;
    //recompile global profiles cache
    $GLOBALS['MySQL']->cleanCache('sys_browse_people');
    $ID = (int) $ID;
    if (!$ID) {
        return false;
    }
    if (!($aProfileInfo = getProfileInfo($ID))) {
        return false;
    }
    $iLoggedInId = getLoggedId();
    db_res("DELETE FROM `sys_admin_ban_list` WHERE `ProfID`='" . $ID . "' LIMIT 1");
    db_res("DELETE FROM `sys_greetings` WHERE `ID` = '{$ID}' OR `Profile` = '{$ID}'");
    db_res("DELETE FROM `sys_block_list` WHERE `ID` = '{$ID}' OR `Profile` = '{$ID}'");
    db_res("DELETE FROM `sys_messages` WHERE Recipient = {$ID} OR `Sender` = {$ID}");
    db_res("DELETE FROM `sys_fave_list` WHERE ID = {$ID} OR Profile = {$ID}");
    db_res("DELETE FROM `sys_friend_list` WHERE ID = {$ID} OR Profile = {$ID}");
    db_res("DELETE FROM `sys_acl_levels_members` WHERE `IDMember` = {$ID}");
    db_res("DELETE FROM `sys_tags` WHERE `ObjID` = {$ID} AND `Type` = 'profile'");
    db_res("DELETE FROM `sys_sbs_entries` WHERE `subscriber_id` = {$ID} AND `subscriber_type` = '1'");
    // delete profile votings
    require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolVoting.php';
    $oVotingProfile = new BxDolVoting('profile', 0, 0);
    $oVotingProfile->deleteVotings($ID);
    // delete profile comments
    require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolCmts.php';
    $oCmts = new BxDolCmts('profile', $ID);
    $oCmts->onObjectDelete();
    // delete all comments in all comments' systems, this user posted
    $oCmts->onAuthorDelete($ID);
    $iPossibleCoupleID = (int) db_value("SELECT `ID` FROM `Profiles` WHERE `Couple` = '{$ID}'");
    if ($iPossibleCoupleID) {
        db_res("DELETE FROM `Profiles` WHERE `ID` = '{$iPossibleCoupleID}'");
        //delete cache file
        deleteUserDataFile($iPossibleCoupleID);
    }
    // delete associated locations
    if (BxDolModule::getInstance('BxWmapModule')) {
        BxDolService::call('wmap', 'response_entry_delete', array('profiles', $ID));
    }
    //delete all subscriptions
    $oSubscription = BxDolSubscription::getInstance();
    $oSubscription->unsubscribe(array('type' => 'object_id', 'unit' => 'profile', 'object_id' => $ID));
    db_res("DELETE FROM `Profiles` WHERE `ID` = '{$ID}'");
    if ($isDeleteSpammer) {
        bx_import('BxDolStopForumSpam');
        $oBxDolStopForumSpam = new BxDolStopForumSpam();
        $oBxDolStopForumSpam->submitSpammer(array('username' => $aProfileInfo['NickName'], 'email' => $aProfileInfo['Email'], 'ip' => bx_member_ip_get_last($ID)));
    }
    // delete moxiemanager files
    $sMoxieFilesPath = BX_DIRECTORY_PATH_ROOT . 'media/moxie/files/' . substr($aProfileInfo['NickName'], 0, 1) . '/' . substr($aProfileInfo['NickName'], 0, 2) . '/' . substr($aProfileInfo['NickName'], 0, 3) . '/' . $aProfileInfo['NickName'];
    bx_rrmdir($sMoxieFilesPath);
    // create system event
    $oZ = new BxDolAlerts('profile', 'delete', $ID, 0, array('profile_info' => $aProfileInfo, 'logged_in' => $iLoggedInId, 'delete_spammer' => $isDeleteSpammer));
    $oZ->alert();
    //delete cache file
    deleteUserDataFile($ID);
}
开发者ID:newton27,项目名称:dolphin.pro,代码行数:61,代码来源:admin.inc.php

示例6: performUnarchive

 protected function performUnarchive($sFilePath, &$sPackagePath)
 {
     $iUmaskSave = umask(0);
     if (!class_exists('ZipArchive')) {
         return _t('_adm_str_err_zip_not_available');
     }
     $oZip = new ZipArchive();
     if ($oZip->open($sFilePath) !== true) {
         return _t('_adm_str_err_cannot_unzip_package');
     }
     $sPackageFolder = '';
     if ($oZip->numFiles > 0) {
         $sPackageFolder = $oZip->getNameIndex(0);
     }
     if (empty($sPackageFolder)) {
         return _t('_adm_str_err_cannot_unzip_package');
     }
     $sPackagePath = BX_DIRECTORY_PATH_TMP . $sPackageFolder;
     if (file_exists($sPackagePath)) {
         // remove existing tmp folder with the same name
         @bx_rrmdir($sPackagePath);
     }
     if (!$oZip->extractTo(BX_DIRECTORY_PATH_TMP)) {
         return _t('_adm_str_err_cannot_unzip_package');
     }
     $oZip->close();
     umask($iUmaskSave);
     return true;
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:29,代码来源:BxDolStudioInstallerUtils.php

示例7: deleteUpgradeFolder

 protected function deleteUpgradeFolder($sPatchPath)
 {
     @bx_rrmdir($this->getTmpFolderFromZip($sPatchPath));
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:4,代码来源:BxDolUpgrader.php

示例8: actionUpload

 function actionUpload($sType, $aFile, $aFtpInfo)
 {
     $sLogin = htmlspecialchars_adv(clear_xss($aFtpInfo['login']));
     $sPassword = htmlspecialchars_adv(clear_xss($aFtpInfo['password']));
     $sPath = htmlspecialchars_adv(clear_xss($aFtpInfo['path']));
     setParam('sys_ftp_login', $sLogin);
     setParam('sys_ftp_password', $sPassword);
     setParam('sys_ftp_dir', $sPath);
     $sErrMsg = false;
     $sName = mktime();
     $sAbsolutePath = BX_DIRECTORY_PATH_ROOT . "tmp/" . $sName . '.zip';
     $sPackageRootFolder = false;
     if (!class_exists('ZipArchive')) {
         $sErrMsg = '_adm_txt_modules_zip_not_available';
     }
     if (!$sErrMsg && $this->_isArchive($aFile['type']) && move_uploaded_file($aFile['tmp_name'], $sAbsolutePath)) {
         // extract uploaded zip package into tmp folder
         $oZip = new ZipArchive();
         if ($oZip->open($sAbsolutePath) !== TRUE) {
             $sErrMsg = '_adm_txt_modules_cannot_unzip_package';
         }
         if (!$sErrMsg) {
             $sPackageRootFolder = $oZip->numFiles > 0 ? $oZip->getNameIndex(0) : false;
             if (file_exists(BX_DIRECTORY_PATH_ROOT . 'tmp/' . $sPackageRootFolder)) {
                 // remove existing tmp folder with the same name
                 bx_rrmdir(BX_DIRECTORY_PATH_ROOT . 'tmp/' . $sPackageRootFolder);
             }
             if ($sPackageRootFolder && !$oZip->extractTo(BX_DIRECTORY_PATH_ROOT . 'tmp/')) {
                 $sErrMsg = '_adm_txt_modules_cannot_unzip_package';
             }
             $oZip->close();
         }
         // upload files to the correct folder via FTP
         if (!$sErrMsg && $sPackageRootFolder) {
             $oFtp = new BxDolFtp($_SERVER['HTTP_HOST'], $sLogin, $sPassword, $sPath);
             if (!$oFtp->connect()) {
                 $sErrMsg = '_adm_txt_modules_cannot_connect_to_ftp';
             }
             if (!$sErrMsg && !$oFtp->isDolphin()) {
                 $sErrMsg = '_adm_txt_modules_destination_not_valid';
             }
             if (!$sErrMsg) {
                 $sConfigPath = BX_DIRECTORY_PATH_ROOT . "tmp/" . $sPackageRootFolder . $this->_aTypesConfig[$sType]['configfile'];
                 if (file_exists($sConfigPath)) {
                     include $sConfigPath;
                     $sConfigVar = !empty($this->_aTypesConfig[$sType]['configvarindex']) ? ${$this->_aTypesConfig[$sType]['configvar']}[$this->_aTypesConfig[$sType]['configvarindex']] : ${$this->_aTypesConfig[$sType]['configvar']};
                     $sSubfolder = $this->_aTypesConfig[$sType]['subfolder'];
                     $sSubfolder = str_replace('{configvar}', $sConfigVar, $sSubfolder);
                     $sSubfolder = str_replace('{packagerootfolder}', $sPackageRootFolder, $sSubfolder);
                     if (!$oFtp->copy(BX_DIRECTORY_PATH_ROOT . "tmp/" . $sPackageRootFolder . '/', $this->_aTypesConfig[$sType]['folder'] . $sSubfolder)) {
                         $sErrMsg = '_adm_txt_modules_ftp_copy_failed';
                     }
                 } else {
                     $sErrMsg = '_adm_txt_modules_wrong_package_format';
                 }
             }
         } else {
             $sErrMsg = '_adm_txt_modules_cannot_unzip_package';
         }
         // remove temporary files
         bx_rrmdir(BX_DIRECTORY_PATH_ROOT . 'tmp/' . $sPackageRootFolder);
         unlink($sAbsolutePath);
     } else {
         $sErrMsg = '_adm_txt_modules_cannot_upload_package';
     }
     return $sErrMsg ? $sErrMsg : '_adm_txt_modules_success_upload';
 }
开发者ID:Arvindvi,项目名称:dolphin,代码行数:67,代码来源:BxDolInstallerUi.php


注:本文中的bx_rrmdir函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。