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


PHP dir::unlink方法代码示例

本文整理汇总了PHP中dir::unlink方法的典型用法代码示例。如果您正苦于以下问题:PHP dir::unlink方法的具体用法?PHP dir::unlink怎么用?PHP dir::unlink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dir的用法示例。


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

示例1: uninstall

 static function uninstall()
 {
     graphics::remove_rules("watermark");
     module::delete("watermark");
     Database::instance()->query("DROP TABLE `watermarks`");
     dir::unlink(VARPATH . "modules/watermark");
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:7,代码来源:watermark_installer.php

示例2: _reset

 private function _reset()
 {
     $db = Database::instance();
     // Drop all tables
     foreach ($db->list_tables() as $table) {
         $db->query("DROP TABLE IF EXISTS `{$table}`");
     }
     // Clean out data
     dir::unlink(VARPATH . "uploads");
     dir::unlink(VARPATH . "albums");
     dir::unlink(VARPATH . "resizes");
     dir::unlink(VARPATH . "thumbs");
     dir::unlink(VARPATH . "modules");
     dir::unlink(VARPATH . "tmp");
     $db->clear_cache();
     module::$modules = array();
     module::$active = array();
     // Use a known random seed so that subsequent packaging runs will reuse the same random
     // numbers, keeping our install.sql file more stable.
     srand(0);
     gallery_installer::install(true);
     module::load_modules();
     foreach (array("user", "comment", "organize", "info", "rss", "search", "slideshow", "tag") as $module_name) {
         module::install($module_name);
         module::activate($module_name);
     }
 }
开发者ID:scarygary,项目名称:gallery3,代码行数:27,代码来源:packager.php

示例3: init_embed

 /**
  * Initialize the embedded Gallery 2 instance.  Call this before any other Gallery 2 calls.
  */
 static function init_embed($embed_path)
 {
     if (!is_file($embed_path)) {
         return false;
     }
     // Gallery 2 defines a class called Gallery.  So does Gallery 3.  They don't get along.  So do
     // a total hack here and copy over a few critical files (embed.php, main.php, bootstrap.inc
     // and Gallery.class) and munge them so that we can rename the Gallery class to be
     // G2_Gallery.   Is this retarded?  Why yes it is.
     //
     // Store the munged files in a directory that's the md5 hash of the embed path so that
     // multiple import sources don't interfere with each other.
     $mod_path = VARPATH . "modules/g2_import/" . md5($embed_path);
     if (!file_exists($mod_path) || !file_exists("{$mod_path}/embed.php")) {
         @dir::unlink($mod_path);
         mkdir($mod_path);
         $config_dir = dirname($embed_path);
         if (filesize($embed_path) > 200) {
             // Regular install
             $base_dir = $config_dir;
         } else {
             // Multisite install.  Line 2 of embed.php will be something like:
             //   require('/usr/home/bharat/public_html/gallery2/embed.php');
             $lines = file($embed_path);
             preg_match("#require\\('(.*)/embed.php'\\);#", $lines[2], $matches);
             $base_dir = $matches[1];
         }
         file_put_contents("{$mod_path}/embed.php", str_replace(array("require_once(dirname(__FILE__) . '/modules/core/classes/GalleryDataCache.class');", "require(dirname(__FILE__) . '/modules/core/classes/GalleryEmbed.class');"), array("require_once('{$base_dir}/modules/core/classes/GalleryDataCache.class');", "require('{$base_dir}/modules/core/classes/GalleryEmbed.class');"), array_merge(array("<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>\n"), file("{$base_dir}/embed.php"))));
         file_put_contents("{$mod_path}/main.php", str_replace(array("include(dirname(__FILE__) . '/bootstrap.inc');", "require_once(dirname(__FILE__) . '/init.inc');"), array("include(dirname(__FILE__) . '/bootstrap.inc');", "require_once('{$base_dir}/init.inc');"), array_merge(array("<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>\n"), file("{$base_dir}/main.php"))));
         file_put_contents("{$mod_path}/bootstrap.inc", str_replace(array("require_once(dirname(__FILE__) . '/modules/core/classes/Gallery.class');", "require_once(dirname(__FILE__) . '/modules/core/classes/GalleryDataCache.class');", "define('GALLERY_CONFIG_DIR', dirname(__FILE__));", "\$gallery =& new Gallery();", "\$GLOBALS['gallery'] =& new Gallery();", "\$gallery = new Gallery();"), array("require_once(dirname(__FILE__) . '/Gallery.class');", "require_once('{$base_dir}/modules/core/classes/GalleryDataCache.class');", "define('GALLERY_CONFIG_DIR', '{$config_dir}');", "\$gallery =& new G2_Gallery();", "\$GLOBALS['gallery'] =& new G2_Gallery();", "\$gallery = new G2_Gallery();"), array_merge(array("<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>\n"), file("{$base_dir}/bootstrap.inc"))));
         file_put_contents("{$mod_path}/Gallery.class", str_replace(array("class Gallery", "function Gallery"), array("class G2_Gallery", "function G2_Gallery"), array_merge(array("<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>\n"), file("{$base_dir}/modules/core/classes/Gallery.class"))));
     }
     require "{$mod_path}/embed.php";
     if (!class_exists("GalleryEmbed")) {
         return false;
     }
     $ret = GalleryEmbed::init();
     if ($ret) {
         return false;
     }
     $admin_group_id = g2(GalleryCoreApi::getPluginParameter("module", "core", "id.adminGroup"));
     $admins = g2(GalleryCoreApi::fetchUsersForGroup($admin_group_id, 1));
     $admin_id = current(array_flip($admins));
     $admin = g2(GalleryCoreApi::loadEntitiesById($admin_id));
     $GLOBALS["gallery"]->setActiveUser($admin);
     // Make sure we have an embed location so that embedded url generation comes out ok.  Without
     // this, the Gallery2 ModRewrite code won't try to do url generation.
     $g2_embed_location = g2(GalleryCoreApi::getPluginParameter("module", "rewrite", "modrewrite.embeddedLocation"));
     if (empty($g2_embed_location)) {
         $g2_embed_location = g2(GalleryCoreApi::getPluginParameter("module", "rewrite", "modrewrite.galleryLocation"));
         g2(GalleryCoreApi::setPluginParameter("module", "rewrite", "modrewrite.embeddedLocation", $g2_embed_location));
         g2($gallery->getStorage()->checkPoint());
     }
     self::$g2_base_url = $g2_embed_location;
     return true;
 }
开发者ID:squadak,项目名称:gallery3,代码行数:59,代码来源:g2_import.php

示例4: remove_album_test

 public function remove_album_test()
 {
     $dirname = VARPATH . "albums/testdir";
     mkdir($dirname, 0777, true);
     $filename = tempnam($dirname, "file");
     touch($filename);
     dir::unlink($dirname);
     $this->assert_boolean(!file_exists($filename), "File not deleted");
     $this->assert_boolean(!file_exists($dirname), "Directory not deleted");
 }
开发者ID:kandsten,项目名称:gallery3,代码行数:10,代码来源:Dir_Helper_Test.php

示例5: item_before_delete

 static function item_before_delete($item)
 {
     // If deleting a photo, make sure the original is deleted as well, if it exists.
     if ($item->is_photo()) {
         $original_file = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $item->file_path());
         if (file_exists($original_file)) {
             @unlink($original_file);
         }
     }
     // When deleting an album, make sure its corresponding location in
     //   VARPATH/original/ is deleted as well, if it exists.
     if ($item->is_album()) {
         $original_file = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $item->file_path());
         if (file_exists($original_file)) {
             @dir::unlink($original_file);
         }
     }
 }
开发者ID:regi01,项目名称:gallery3-contrib,代码行数:18,代码来源:keeporiginal_event.php

示例6: unlink

 static function unlink($path)
 {
     if (is_dir($path) && is_writable($path)) {
         foreach (new DirectoryIterator($path) as $resource) {
             if ($resource->isDot()) {
                 unset($resource);
                 continue;
             } else {
                 if ($resource->isFile()) {
                     unlink($resource->getPathName());
                 } else {
                     if ($resource->isDir()) {
                         dir::unlink($resource->getRealPath());
                     }
                 }
             }
             unset($resource);
         }
         return @rmdir($path);
     }
     return false;
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:22,代码来源:dir.php

示例7: delete

 public function delete()
 {
     $old = clone $this;
     module::event("item_before_delete", $this);
     $parent = $this->parent();
     if ($parent->album_cover_item_id == $this->id) {
         item::remove_album_cover($parent);
     }
     $path = $this->file_path();
     $resize_path = $this->resize_path();
     $thumb_path = $this->thumb_path();
     parent::delete();
     if (is_dir($path)) {
         @dir::unlink($path);
         @dir::unlink(dirname($resize_path));
         @dir::unlink(dirname($thumb_path));
     } else {
         @unlink($path);
         @unlink($resize_path);
         @unlink($thumb_path);
     }
     module::event("item_deleted", $old);
 }
开发者ID:ChrisRut,项目名称:gallery3,代码行数:23,代码来源:item.php

示例8: init_embed

 /**
  * Initialize the embedded Gallery2 instance.  Call this before any other Gallery2 calls.
  */
 static function init_embed($embed_path)
 {
     if (!is_file($embed_path)) {
         return false;
     }
     // Gallery2 defines a class called Gallery.  So does Gallery 3.  They don't get along.  So do
     // a total hack here and copy over a few critical files (embed.php, main.php, bootstrap.inc
     // and Gallery.class) and munge them so that we can rename the Gallery class to be
     // G2_Gallery.   Is this retarded?  Why yes it is.
     //
     // Store the munged files in a directory that's the md5 hash of the embed path so that
     // multiple import sources don't interfere with each other.
     $mod_path = VARPATH . "modules/g2_import/" . md5($embed_path);
     if (!file_exists($mod_path) || !file_exists("{$mod_path}/embed.php")) {
         @dir::unlink($mod_path);
         mkdir($mod_path);
         $base_dir = dirname($embed_path);
         file_put_contents("{$mod_path}/embed.php", str_replace(array("require_once(dirname(__FILE__) . '/modules/core/classes/GalleryDataCache.class');", "require(dirname(__FILE__) . '/modules/core/classes/GalleryEmbed.class');"), array("require_once('{$base_dir}/modules/core/classes/GalleryDataCache.class');", "require('{$base_dir}/modules/core/classes/GalleryEmbed.class');"), array_merge(array("<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>\n"), file("{$base_dir}/embed.php"))));
         file_put_contents("{$mod_path}/main.php", str_replace(array("include(dirname(__FILE__) . '/bootstrap.inc');", "require_once(dirname(__FILE__) . '/init.inc');"), array("include(dirname(__FILE__) . '/bootstrap.inc');", "require_once('{$base_dir}/init.inc');"), array_merge(array("<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>\n"), file("{$base_dir}/main.php"))));
         file_put_contents("{$mod_path}/bootstrap.inc", str_replace(array("require_once(dirname(__FILE__) . '/modules/core/classes/Gallery.class');", "require_once(dirname(__FILE__) . '/modules/core/classes/GalleryDataCache.class');", "define('GALLERY_CONFIG_DIR', dirname(__FILE__));", "\$gallery =& new Gallery();"), array("require_once(dirname(__FILE__) . '/Gallery.class');", "require_once('{$base_dir}/modules/core/classes/GalleryDataCache.class');", "define('GALLERY_CONFIG_DIR', '{$base_dir}');", "\$gallery =& new G2_Gallery();"), array_merge(array("<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>\n"), file("{$base_dir}/bootstrap.inc"))));
         file_put_contents("{$mod_path}/Gallery.class", str_replace(array("class Gallery", "function Gallery"), array("class G2_Gallery", "function G2_Gallery"), array_merge(array("<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>\n"), file("{$base_dir}/modules/core/classes/Gallery.class"))));
     }
     require "{$mod_path}/embed.php";
     if (!class_exists("GalleryEmbed")) {
         return false;
     }
     $ret = GalleryEmbed::init();
     if ($ret) {
         return false;
     }
     $admin_group_id = g2(GalleryCoreApi::getPluginParameter("module", "core", "id.adminGroup"));
     $admins = g2(GalleryCoreApi::fetchUsersForGroup($admin_group_id, 1));
     $admin_id = current(array_flip($admins));
     $admin = g2(GalleryCoreApi::loadEntitiesById($admin_id));
     $GLOBALS["gallery"]->setActiveUser($admin);
     return true;
 }
开发者ID:xafr,项目名称:gallery3,代码行数:40,代码来源:g2_import.php

示例9: uninstall

 static function uninstall()
 {
     dir::unlink(VARPATH . "modules/aws_s3");
 }
开发者ID:Retroguy,项目名称:gallery3-contrib,代码行数:4,代码来源:aws_s3_installer.php

示例10: uninstall

 static function uninstall()
 {
     Database::instance()->query("DROP TABLE {watermarks}");
     dir::unlink(VARPATH . "modules/watermark");
 }
开发者ID:Okat,项目名称:gallery3,代码行数:5,代码来源:watermark_installer.php

示例11: delete

 public function delete($ignored_id = null)
 {
     if (!$this->loaded()) {
         // Concurrent deletes may result in this item already being gone.  Ignore it.
         return;
     }
     if ($this->id == 1) {
         $v = new Validation(array("id"));
         $v->add_error("id", "cant_delete_root_album");
         ORM_Validation_Exception::handle_validation($this->table_name, $v);
     }
     $old = clone $this;
     module::event("item_before_delete", $this);
     $parent = $this->parent();
     if ($parent->album_cover_item_id == $this->id) {
         item::remove_album_cover($parent);
     }
     $path = $this->file_path();
     $resize_path = $this->resize_path();
     $thumb_path = $this->thumb_path();
     parent::delete();
     if (is_dir($path)) {
         // Take some precautions against accidentally deleting way too much
         $delete_resize_path = dirname($resize_path);
         $delete_thumb_path = dirname($thumb_path);
         if ($delete_resize_path == VARPATH . "resizes" || $delete_thumb_path == VARPATH . "thumbs" || $path == VARPATH . "albums") {
             throw new Exception("@todo DELETING_TOO_MUCH ({$delete_resize_path}, {$delete_thumb_path}, {$path})");
         }
         @dir::unlink($path);
         @dir::unlink($delete_resize_path);
         @dir::unlink($delete_thumb_path);
     } else {
         @unlink($path);
         @unlink($resize_path);
         @unlink($thumb_path);
     }
     module::event("item_deleted", $old);
 }
开发者ID:assad2012,项目名称:gallery3-appfog,代码行数:38,代码来源:item.php

示例12: uninstall

 static function uninstall()
 {
     dir::unlink(VARPATH . "modules/aws_s3");
     Database::instance()->query("DROP TABLE {aws_s3_meta}");
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:5,代码来源:aws_s3_installer.php

示例13: htaccess_works

 /**
  * Verify that our htaccess based permission system actually works.  Create a temporary
  * directory containing an .htaccess file that uses mod_rewrite to redirect /verify to
  * /success.  Then request that url.  If we retrieve it successfully, then our redirects are
  * working and our permission system works.
  */
 static function htaccess_works()
 {
     $success_url = url::file("var/tmp/security_test/success");
     @mkdir(VARPATH . "tmp/security_test");
     if ($fp = @fopen(VARPATH . "tmp/security_test/.htaccess", "w+")) {
         fwrite($fp, "RewriteEngine On\n");
         fwrite($fp, "RewriteRule verify {$success_url} [L]\n");
         fclose($fp);
     }
     if ($fp = @fopen(VARPATH . "tmp/security_test/success", "w+")) {
         fwrite($fp, "success");
         fclose($fp);
     }
     list($response) = remote::do_request(url::abs_file("var/tmp/security_test/verify"));
     $works = $response == "HTTP/1.1 200 OK";
     @dir::unlink(VARPATH . "tmp/security_test");
     return $works;
 }
开发者ID:hiwilson,项目名称:gallery3,代码行数:24,代码来源:access.php

示例14: delete

 public function delete()
 {
     $original_path = $this->file_path();
     $original_resize_path = $this->resize_path();
     $original_thumb_path = $this->thumb_path();
     // If there is no name, the path is invalid so don't try to delete
     if (!empty($this->name)) {
         if ($this->is_album()) {
             dir::unlink(dirname($original_path));
             dir::unlink(dirname($original_resize_path));
             dir::unlink(dirname($original_thumb_path));
         } else {
             unlink($original_path);
             unlink($original_resize_path);
             unlink($original_thumb_path);
         }
     }
     parent::delete();
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:19,代码来源:item.php

示例15: uninstall

 static function uninstall()
 {
     @dir::unlink(VARPATH . "modules/g2_import");
 }
开发者ID:Okat,项目名称:gallery3,代码行数:4,代码来源:g2_import_installer.php


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