示例#1
0
 function clear_static()
 {
     if (!$this->get_domain()) {
         return false;
     }
     $root = core::module('sat')->get_static_root($this);
     $data = array();
     fs::build_tree($root, $data);
     foreach ($data['files'] as $f) {
         fs::unlink($f);
     }
     $data['dirs'] = array_reverse($data['dirs']);
     foreach ($data['dirs'] as $f) {
         fs::unlink($f, true);
     }
 }
示例#2
0
 /**
  * format on delete
  */
 function format_field_on_remove($vf, &$fld, $current)
 {
     $type = $vf['type'];
     switch ($type) {
         case 'image':
         case 'file':
             if (!empty($current['file'])) {
                 fs::unlink($current['file']);
                 if (!empty($current['thumbnail']['file'])) {
                     fs::unlink($current['thumbnail']['file']);
                 }
                 if (!empty($current['original']['file'])) {
                     fs::unlink($current['original']['file']);
                 }
             }
             break;
     }
 }
示例#3
0
 function clear_static($with_parent = true)
 {
     $s = $this->get_site();
     if (!$s || !$s->is_staticable()) {
         return;
     }
     $file = core::module('sat')->get_static_node_path($this);
     fs::unlink($file);
     core::dprint(array('node::clear_static : %d [%d]', $this->id, $this->pid), core::E_DEBUG3);
     // unlink pagination chunks, yes its hack
     if (strpos($file, '/index.html') !== false) {
         $file = str_replace('/index.html', "/*/*/index.html", $file);
         foreach (glob($file) as $f) {
             fs::unlink($f);
         }
     }
     if ($with_parent && ($p = $this->get_parent())) {
         $p->clear_static(false);
     }
 }