예제 #1
0
 /**
  * Purge a property completely
  * @author Howard <*****@*****.**>
  * @static
  * @param int $property_id
  * @param boolean $trigger_event
  * @return boolean
  */
 public static function purge($property_id, $trigger_event = true)
 {
     /** first validation **/
     if (!trim($property_id)) {
         return false;
     }
     $property_data = self::get_property_raw_data($property_id);
     /** trigger event **/
     if ($trigger_event) {
         wpl_global::event_handler('property_before_purge', array('property_id' => $property_id, 'property_data' => $property_data));
     }
     /** purging property related data **/
     _wpl_import('libraries.items');
     wpl_items::delete_all_items($property_id, $property_data['kind']);
     /** purging property record **/
     wpl_db::delete('wpl_properties', $property_id);
     /** purging property folder **/
     wpl_folder::delete(wpl_items::get_path($property_id));
     /** trigger event **/
     if ($trigger_event) {
         wpl_global::event_handler('property_purged', array('property_id' => $property_id, 'property_data' => $property_data));
     }
     return true;
 }