Пример #1
0
 /**
  * delete items related to one anchor
  *
  * This function is invoked to ensure that the database is cleaned when some anchor is deleted.
  *
  * The delete_related_to hook is used to invoke any software extension bound as follows:
  * - id: 'shared/anchors.php#delete_related_to'
  * - type: 'include'
  * - parameters: string the reference that is deleted (e.g., 'section:123')
  *
  * @param string reference of the deleted anchor (e.g., 'article:12')
  */
 public static function delete_related_to($anchor)
 {
     global $context;
     // delete related articles
     Articles::delete_for_anchor($anchor);
     // delete related categories
     Categories::delete_for_anchor($anchor);
     // delete related comments
     include_once $context['path_to_root'] . 'comments/comments.php';
     Comments::delete_for_anchor($anchor);
     // delete related dates
     include_once $context['path_to_root'] . 'dates/dates.php';
     Dates::delete_for_anchor($anchor);
     // delete related files
     Files::delete_for_anchor($anchor);
     // delete related images
     include_once $context['path_to_root'] . 'images/images.php';
     Images::delete_for_anchor($anchor);
     // delete related links
     include_once $context['path_to_root'] . 'links/links.php';
     Links::delete_for_anchor($anchor);
     // delete related locations
     include_once $context['path_to_root'] . 'locations/locations.php';
     Locations::delete_for_anchor($anchor);
     // delete related sections
     Sections::delete_for_anchor($anchor);
     // delete related tables
     include_once $context['path_to_root'] . 'tables/tables.php';
     Tables::delete_for_anchor($anchor);
     // delete related versions
     include_once $context['path_to_root'] . 'versions/versions.php';
     Versions::delete_for_anchor($anchor);
     // delete memberships for this anchor
     Members::unlink_for_reference($anchor);
     // the delete_related_to hook
     if (is_callable(array('Hooks', 'include_scripts'))) {
         $context['text'] .= Hooks::include_scripts('shared/anchors.php#delete_related_to', $anchor);
     }
 }