Skip to content

Commit

Permalink
Adds ProcessTable class so that processes can be easily found by clas…
Browse files Browse the repository at this point in the history
…s name and status. Adds commented debugging code to the background process. Removes empty setStatus function from ProcessAbstract.
  • Loading branch information
willynilly committed Sep 18, 2009
1 parent 308e81a commit 015fb17
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 7 deletions.
16 changes: 14 additions & 2 deletions application/core/background.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
// Require the necessary files.
$baseDir = dirname(__FILE__);

require "{$baseDir}/../../paths.php";
require "{$baseDir}/../libraries/Omeka/Core.php";
require_once("{$baseDir}/../../paths.php");
require_once("{$baseDir}/../libraries/Omeka/Core.php");

// Set the command line arguments.
$options = new Zend_Console_Getopt(array('process|p=i' => 'process to run', 'lastphase|l=s' => 'last phase to load'));
Expand Down Expand Up @@ -44,9 +44,21 @@
// Get the name of the process class to run
$processClass = $process->class;

//echo $processClass . "\n";

// Get the process arguments
$processArgs = $process->getArguments();

//print_r($processArgs);
//echo "\n";

// if (class_exists($processClass)) {
// echo 'class exists';
// } else {
// echo 'no class';
// }
// echo "\n";

// Create a custom process object
$processObject = new $processClass($process);

Expand Down
5 changes: 0 additions & 5 deletions application/models/ProcessAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,4 @@ final public function __destruct()
}

abstract public function run($args);

public function setStatus()
{

}
}
24 changes: 24 additions & 0 deletions application/models/ProcessTable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* @version $Id$
* @copyright Center for History and New Media, 2007-2009
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @subpackage Models
* @author CHNM
**/
class ProcessTable extends Omeka_Db_Table
{
protected $_target = 'Process';

public function findByClass($className)
{
$select = $this->getSelect()->where("p.class = ?");
return $this->fetchObjects($select, array($className));
}

public function findByStatus($status)
{
$select = $this->getSelect()->where("p.status = ?");
return $this->fetchObjects($select, array($status));
}
}

0 comments on commit 015fb17

Please sign in to comment.