Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
CitationApiHandler.inc.php
1 <?php
19 // import the base Handler
20 import('lib.pkp.classes.handler.PKPHandler');
21 
26  function CitationApiHandler() {
27  parent::PKPHandler();
28  }
29 
30 
31  //
32  // Implement template methods from PKPHandler
33  //
37  function authorize($request, &$args, $roleAssignments) {
38  import('lib.pkp.classes.security.authorization.PKPProcessAccessPolicy');
39  $this->addPolicy(new PKPProcessAccessPolicy($request, $args, 'checkAllCitations'));
40  return parent::authorize($request, $args, $roleAssignments);
41  }
42 
43 
44  //
45  // Public handler methods
46  //
61  function checkAllCitations($args, $request) {
62  // This is potentially a long running request. So
63  // give us unlimited execution time.
64  ini_set('max_execution_time', 0);
65 
66  // Get the process id.
67  $processId = $args['authToken'];
68 
69  // Run until all citations have been checked.
70  $processDao = DAORegistry::getDAO('ProcessDAO');
71  $citationDao = DAORegistry::getDAO('CitationDAO');
72  do {
73  // Check that the process lease has not expired.
74  $continue = $processDao->canContinue($processId);
75 
76  if ($continue) {
77  // Check the next citation.
78  $continue = $citationDao->checkNextRawCitation($request, $processId);
79  }
80  } while ($continue);
81 
82  // Free the process slot.
83  $processDao->deleteObjectById($processId);
84 
85  // This request returns just a (private) status message.
86  return 'Done!';
87  }
88 }
89 ?>
static & getDAO($name, $dbconn=null)
addPolicy($authorizationPolicy, $addToTop=false)
authorize($request, &$args, $roleAssignments)
Class defining the headless API for backend citation manipulation.
checkAllCitations($args, $request)
Class to control access to handler operations based on a one time key that authorizes a process to ex...