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


PHP rrmdir函数代码示例

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


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

示例1: MessageAdd

function MessageAdd($msg, $headers, $files = NULL)
{
    global $DB, $LMS, $tmppath;
    $time = time();
    $head = '';
    if ($headers) {
        foreach ($headers as $idx => $header) {
            $head .= $idx . ": " . $header . "\n";
        }
    }
    $DB->Execute('INSERT INTO rtmessages (ticketid, createtime, subject, body, userid, customerid, mailfrom, inreplyto, messageid, replyto, headers)
			VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', array($msg['ticketid'], $time, $msg['subject'], preg_replace("/\r/", "", $msg['body']), $msg['userid'], $msg['customerid'], $msg['mailfrom'], $msg['inreplyto'], $msg['messageid'], isset($msg['replyto']) ? $msg['replyto'] : $headers['Reply-To'], $head));
    $mail_dir = ConfigHelper::getConfig('rt.mail_dir');
    if (!empty($files) && !empty($mail_dir)) {
        $id = $DB->GetLastInsertId('rtmessages');
        $dir = $mail_dir . sprintf('/%06d/%06d', $msg['ticketid'], $id);
        @mkdir($mail_dir . sprintf('/%06d', $msg['ticketid']), 0700);
        @mkdir($dir, 0700);
        foreach ($files as $file) {
            $newfile = $dir . '/' . $file['name'];
            if (@rename($tmppath . DIRECTORY_SEPARATOR . $file['name'], $newfile)) {
                $DB->Execute('INSERT INTO rtattachments (messageid, filename, contenttype) 
						VALUES (?,?,?)', array($id, $file['name'], $file['type']));
            }
        }
        rrmdir($tmppath);
    }
}
开发者ID:prezeskk,项目名称:lms,代码行数:28,代码来源:rtmessageadd.php

示例2: clear_old_sessions

function clear_old_sessions()
{
    global $dbh;
    $lockfile = "data/sessions.lock";
    // do it only once in a while
    if (file_exists($lockfile) && filemtime($lockfile) > time() - 604800) {
        return;
    }
    touch($lockfile);
    if ($handle = opendir("data/sessions/")) {
        while (false !== ($file = readdir($handle))) {
            if ($file != "." && $file != "..") {
                $stemp = unserialize(file_get_contents("data/sessions/" . $file));
                if ($stemp['user'] === 'guest' && $stemp['timestamp'] < time() - 604800) {
                    $query = sprintf("SELECT directory FROM lists\n                          WHERE user_id=2 AND sid=%s", $dbh->quote($stemp['sid']));
                    $result = $dbh->query($query);
                    if ($result == FALSE) {
                        return -1;
                    }
                    while ($row = $result->fetchColumn()) {
                        rrmdir($row);
                    }
                    $query = sprintf("DELETE FROM lists\n                          WHERE user_id=2 AND\n                          sid=%s", $dbh->quote($stemp['sid']));
                    if ($dbh->exec($query) === FALSE) {
                        return -2;
                    }
                    //	  unlink ("data/sessions/" . $file);
                }
            }
        }
        closedir($handle);
    }
}
开发者ID:scovit,项目名称:nust-helico,代码行数:33,代码来源:add_list.php

示例3: createFileFromChunks

/**
 *
 * Check if all the parts exist, and
 * gather all the parts of the file together
 * @param string $dir - the temporary directory holding all the parts of the file
 * @param string $fileName - the original file name
 * @param string $chunkSize - each chunk size (in bytes)
 * @param string $totalSize - original file size (in bytes)
 */
function createFileFromChunks($temp_dir, $fileName, $chunkSize, $totalSize)
{
    // count all the parts of this file
    $total_files = 0;
    foreach (scandir($temp_dir) as $file) {
        if (stripos($file, $fileName) !== false) {
            $total_files++;
        }
    }
    // check that all the parts are present
    // the size of the last part is between chunkSize and 2*$chunkSize
    if ($total_files * $chunkSize >= $totalSize - $chunkSize + 1) {
        // create the final destination file
        if (($fp = fopen('../files/' . $_POST['course_id'] . '/' . $fileName, 'w')) !== false) {
            for ($i = 1; $i <= $total_files; $i++) {
                fwrite($fp, file_get_contents($temp_dir . '/' . $fileName . '.part' . $i));
                _log('writing chunk ' . $i);
            }
            fclose($fp);
        } else {
            echo 'cannot create the destination file';
            return false;
        }
        // rename the temporary directory (to avoid access from other
        // concurrent chunks uploads) and than delete it
        if (rename($temp_dir, $temp_dir . '_UNUSED')) {
            rrmdir($temp_dir . '_UNUSED');
        } else {
            rrmdir($temp_dir);
        }
    }
}
开发者ID:ChrisHuston,项目名称:Announcement-Master,代码行数:41,代码来源:fileUpload.php

示例4: delete_plugin

/**
 * This functions remove a plugin from the OCS webconsole and database.
 * Delete all created menu entries and all plugin related code
 * 
 * @param integer $pluginid : Plugin id in DB
 */
function delete_plugin($pluginid)
{
    global $l;
    $conn = new PDO('mysql:host=' . SERVER_WRITE . ';dbname=' . DB_NAME . '', COMPTE_BASE, PSWD_BASE);
    $query = $conn->query("SELECT * FROM `plugins` WHERE id = '" . $pluginid . "'");
    $anwser = $query->fetch();
    if (!class_exists('plugins')) {
        require 'plugins.class.php';
    }
    if (!function_exists('exec_plugin_soap_client')) {
        require 'functions_webservices.php';
    }
    if ($anwser['name'] != "" and $anwser['name'] != null) {
        require MAIN_SECTIONS_DIR . "ms_" . $anwser['name'] . "/install.php";
        $fonc = "plugin_delete_" . $anwser['name'];
        $fonc();
    }
    rrmdir(MAIN_SECTIONS_DIR . "ms_" . $anwser['name']);
    rrmdir(PLUGINS_DIR . "computer_detail/cd_" . $anwser['name']);
    if (file_exists(PLUGINS_SRV_SIDE . $anwser['name'] . ".zip")) {
        unlink(PLUGINS_SRV_SIDE . $anwser['name'] . ".zip");
        exec_plugin_soap_client($anwser['name'], 0);
    }
    $conn->query("DELETE FROM `" . DB_NAME . "`.`plugins` WHERE `plugins`.`id` = " . $pluginid . " ");
}
开发者ID:remicollet,项目名称:OCSInventory-ocsreports,代码行数:31,代码来源:functions_delete.php

示例5: rrmdir

function rrmdir($dir)
{
    $now = time();
    $diff = 2592000;
    if (is_dir($dir)) {
        print "\nScanning: " . $dir . '/';
        $objects = scandir($dir);
        foreach ($objects as $object) {
            if ($object != "." && $object != "..") {
                if (filetype($dir . "/" . $object) == "dir") {
                    rrmdir($dir . "/" . $object);
                } else {
                    $sub = $now - date("U", filemtime($dir . "/" . $object));
                    if ($sub > $diff) {
                        if (@unlink($dir . "/" . $object)) {
                            print "\n" . $dir . "/" . $object . " deleted";
                            //print "\nlast modified time: ".date("U", filemtime($dir."/".$object));
                            //print "\n".$now;
                            //print "\n".$sub;
                        } else {
                            print "\n" . $dir . "/" . $object . " ----------------- failed";
                        }
                    }
                }
            }
        }
        reset($objects);
        //@rmdir($dir);
    }
}
开发者ID:sergrin,项目名称:crawlers-il,代码行数:30,代码来源:delete_old_images_from_netup.php

示例6: rcopy

function rcopy($src, $dst)
{
    if (file_exists($dst)) {
        //rrmdir ( $dst );
    }
    if (is_dir($src)) {
        $files = scandir($src);
        mkdir($dst);
        foreach ($files as $file) {
            if ($file != '.' && $file != '..') {
                rcopy($src . '/' . $file, $dst . '/' . $file);
                rrmdir($src . '/' . $file);
            }
            $iterator = new FilesystemIterator($src);
            $isDirEmpty = !$iterator->valid();
            if ($isDirEmpty) {
                rmdir($src);
            }
        }
    } else {
        if (file_exists($src)) {
            copy($src, $dst);
        }
    }
}
开发者ID:kevwaddell,项目名称:tlw-echosign,代码行数:25,代码来源:file-copy-functions.php

示例7: clear

 public function clear()
 {
     $location = $this->getCacheLocation();
     if ($location) {
         rrmdir($location);
     }
 }
开发者ID:nyeholt,项目名称:silverstripe-simplecache,代码行数:7,代码来源:SimpleCacheStores.php

示例8: rrmdir

function rrmdir($dir)
{
    global $dryrun;
    foreach (glob($dir . '/*') as $file) {
        if (is_dir($file)) {
            rrmdir($file);
        } else {
            if ($dryrun) {
                echo "    would be unlinking {$file}\n";
            } else {
                echo "    unlinking {$file}\n";
                unlink($file);
            }
        }
    }
    if ($dryrun) {
        echo "    would be removing {$dir}\n";
    } else {
        echo "    removing {$dir}\n";
        if (file_exists($dir . "/.DS_Store")) {
            echo "    unlinking " . $dir . "/.DS_Store\n";
            unlink($dir . "/.DS_Store");
        }
        rmdir($dir);
    }
}
开发者ID:chandradrupal,项目名称:resourcespace,代码行数:26,代码来源:prune_filestore.php

示例9: delete_record_and_dir

function delete_record_and_dir($delete_array, $table)
{
    global $dbh;
    // Delete the directories
    $query = sprintf("SELECT directory FROM %s WHERE 0", $dbh->quote($table));
    for ($i = 0; $i < count($delete_array); $i++) {
        $query .= sprintf(" OR rec_id=%s", $dbh->quote($delete_array[$i]));
    }
    $result = $dbh->query($query);
    if ($result === FALSE) {
        echo "internal error, could not delete " . $table;
        echo " on database" . '<br />';
        print_r($_GET);
        echo '<br />';
    }
    while ($row = $result->fetch(PDO::FETCH_NUM)) {
        rrmdir($row[0]);
    }
    //  Expunge the records from the database
    $query = sprintf("DELETE FROM %s WHERE 0", $dbh->quote($table));
    for ($i = 0; $i < count($delete_array); $i++) {
        $query .= sprintf(" OR rec_id=%s", $dbh->quote($delete_array[$i]));
    }
    if ($dbh->exec($query) === FALSE) {
        echo "internal error, couldn't delete " . $table;
        echo " on database" . '<br />';
        print_r($_GET);
        echo '<br />';
    }
}
开发者ID:scovit,项目名称:nust-helico,代码行数:30,代码来源:tables.php

示例10: restore

 public function restore($fileName = false)
 {
     $backups = scandir(self::getConfigItem("application", "backup_path"));
     $backups = array_slice($backups, 2);
     sort($backups);
     $backups = array_reverse($backups);
     $this->parser->assign("backups", $backups);
     if ((!$_FILES || !$_FILES["file"] || !$_FILES["file"]["tmp_name"]) && (!$fileName || !is_file(self::getConfigItem("application", "backup_path") . $fileName))) {
         $this->parser->assign("result", false);
         $this->parser->parse("backend/admin_backup.restore.tpl");
     } else {
         $f = new finfo(FILEINFO_MIME);
         $this->load->library('unzip');
         $file = $fileName ? self::getConfigItem("application", "backup_path") . $fileName : $_FILES["file"]["tmp_name"];
         if ($f && ($mime = $f->file($file)) && preg_match("/^application\\/zip/", $mime) && $this->unzip->extract($file, self::getConfigItem("application", "tmp_path")) && is_file("application/tmp/database.sql") && is_dir("application/tmp/uploads/")) {
             @rename("application/tmp/uploads", "public/uploads");
             $s = explodeSqlFile("application/tmp/database.sql");
             foreach ($s as $query) {
                 $this->db->query($query);
             }
             $this->parser->assign("result", "ok");
         } else {
             $this->parser->assign("result", "error");
         }
         rrmdir("application/tmp", false);
         $this->parser->parse("backend/admin_backup.restore.tpl");
     }
 }
开发者ID:andrejjursa,项目名称:fmfi-tis,代码行数:28,代码来源:admin_backup.php

示例11: rrmdir

function rrmdir($dir)
{
    // Verifica se é um diretório
    // @since rev 1
    if (is_dir($dir)) {
        // Percorre os arquivos do diretório
        // @since rev 1
        $objects = scandir($dir);
        foreach ($objects as $object) {
            // Pula os controles
            // @since rev 1
            if ($object != "." && $object != "..") {
                // Verifica se é um diretório para recursar
                // @since rev 1
                if (filetype($dir . "/" . $object) == "dir") {
                    rrmdir($dir . "/" . $object);
                } else {
                    unlink($dir . "/" . $object);
                }
            }
        }
        // Limpa os objetos
        // @since rev 1
        reset($objects);
        rmdir($dir);
    }
}
开发者ID:BGCX067,项目名称:fabulafw-svn-to-git,代码行数:27,代码来源:functions.extras.php

示例12: rrmdir

function rrmdir($dir)
{
    foreach (glob($dir . '/*') as $file) {
        if (is_dir($file)) {
            rrmdir($file);
        } else {
            unlink($file);
        }
    }
    // also check for hidden files/folders, these are not found with the '/*' pattern
    // Matlab runtime environment creates these in the mcr folder
    foreach (glob($dir . '/.*') as $file) {
        // get last occurrence of /
        $tail = strrchr($file, "/");
        // skip . and .. directories
        if ($tail != '/.' and $tail != '/..') {
            if (is_dir($file)) {
                rrmdir($file);
            } else {
                unlink($file);
            }
        }
    }
    rmdir($dir);
}
开发者ID:JaapGroen,项目名称:WAD_Interface,代码行数:25,代码来源:new_analysemodule.php

示例13: rrmdir

function rrmdir($dir)
{
    $files = array_diff(scandir($dir), array('.', '..'));
    foreach ($files as $file) {
        is_dir("{$dir}/{$file}") ? rrmdir("{$dir}/{$file}") : unlink("{$dir}/{$file}");
    }
    return rmdir($dir);
}
开发者ID:blr21560,项目名称:framadate,代码行数:8,代码来源:packaging.php

示例14: cache_images

function cache_images($images)
{
    rrmdir(__DIR__ . '/img');
    mkdir(__DIR__ . '/img');
    foreach ($images as $id => $image) {
        cache_file(get_raw_url($image->path), __DIR__ . '/img/' . basename($image->path));
    }
}
开发者ID:raphaelbastide,项目名称:Website-for-1962,代码行数:8,代码来源:lib.php

示例15: testSubWithConf

 function testSubWithConf()
 {
     require_once 'FittestPhpLoggerConfig.php';
     $tmpdir = setupTmpDir(array("a", "b", "c", "d"), 2, PROP_ENABLED . "=true");
     $conf = new FittestPhpLoggerConfig();
     $this->assertTrue($conf->isActive());
     rrmdir($tmpdir);
 }
开发者ID:nanliu0408,项目名称:fittest,代码行数:8,代码来源:FittestPhpLoggerConfigTest.php


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