Paperyard
Public Member Functions | Public Attributes | List of all members
ppyrd Class Reference
Inheritance diagram for ppyrd:
dbHandler pdfNamer pdfScanner pdfSorter

Public Member Functions

 __construct ($db)
 constructor More...
 
 checkCliVsWebserver ()
 
 output ($string, $debug=0)
 outputs string More...
 

Public Attributes

 $db
 

Detailed Description

Definition at line 9 of file ppyrd.base.php.

Constructor & Destructor Documentation

ppyrd::__construct (   $db)

constructor

Definition at line 24 of file ppyrd.base.php.

24  {
25  $this->db = $db;
26  $this->output("checking setup");
27 
28  // checks that all relevant directories have been mounted.
29  $warning = array();
30  if (file_exists('/data/scan/paperyardDirectoryNotMounted.txt'))
31  {
32  $warning[]= "scan folder not properly mounted. Please specify /data/scan in docker run command.\n";
33  }
34  if (file_exists('/data/inbox/paperyardDirectoryNotMounted.txt'))
35  {
36  $warning[]= "inbox folder not properly mounted. Please specify /data/inbox in docker run command.\n";
37  }
38  if (file_exists('/data/outbox/paperyardDirectoryNotMounted.txt'))
39  {
40  $warning[]= "outbox folder not properly mounted. Please specify /data/outbox in docker run command.\n";
41  }
42  if (file_exists('/data/sort/paperyardDirectoryNotMounted.txt'))
43  {
44  $warning[]= "sort folder not properly mounted. Please specify /sort/outbox in docker run command.\n";
45  }
46  if (file_exists('/data/database/paperyardDirectoryNotMounted.txt'))
47  {
48  $warning[]= "database folder not properly mounted. Please specify /data/database in docker run command.\n";
49  }
50  $this->warning = $warning;
51  $warningMessage = join($warning, "");
52  if (!empty($warning))
53  echo "docker run not properly set:" . $warningMessage;
54 
55  } // End constructor
output($string, $debug=0)
outputs string
Definition: ppyrd.base.php:78

Member Function Documentation

ppyrd::checkCliVsWebserver ( )

Definition at line 57 of file ppyrd.base.php.

58  {
59  if ("cli" == php_sapi_name())
60  {
61  $this->output("Program call from CLI detected.");
62  if ($this->db->getConfigValue('enableCron')==0) {
63  $this->output("please enable cron in config");
64  die();
65  }
66  }else{
67  $this->output("Program call from Webserver detected.");
68  }
69  }
output($string, $debug=0)
outputs string
Definition: ppyrd.base.php:78
ppyrd::output (   $string,
  $debug = 0 
)

outputs string

Bug:
no debug handling implemented yet. https://github.com/tlwt/paperyard/issues/10
Parameters
string$stringto output
int$debugset to 1 to debug

Definition at line 78 of file ppyrd.base.php.

79  {
80  //$logProgram = basename(__FILE__, '.php');
81  $logProgram = basename($_SERVER['SCRIPT_NAME']);
82  echo "$logProgram: $string\n";
83 
84  $this->db->exec("INSERT INTO logShell (logProgram, logContent) VALUES ('$logProgram','$string');");
85  }

Member Data Documentation

ppyrd::$db

Definition at line 19 of file ppyrd.base.php.


The documentation for this class was generated from the following file: