]> git.mxchange.org Git - friendica.git/blob - include/dsprphotoq.php
Replaced $argv and $argc with the $_SERVER array
[friendica.git] / include / dsprphotoq.php
1 <?php
2 require_once("boot.php");
3 require_once('include/diaspora.php');
4
5 function dsprphotoq_run($argv, $argc){
6         global $a, $db;
7
8         if(is_null($a)){
9                 $a = new App;
10         }
11
12         if(is_null($db)){
13                 @include(".htconfig.php");
14                 require_once("include/dba.php");
15                 $db = new dba($db_host, $db_user, $db_pass, $db_data);
16                 unset($db_host, $db_user, $db_pass, $db_data);
17         };
18
19         logger("diaspora photo queue: running", LOGGER_DEBUG);
20
21         $r = q("SELECT * FROM dsprphotoq");
22         if(!$r)
23                 return;
24
25         $dphotos = $r;
26
27         logger("diaspora photo queue: processing " . count($dphotos) . " photos");
28
29         foreach($dphotos as $dphoto) {
30
31                 $r = q("SELECT * FROM user WHERE uid = %d",
32                         intval($dphoto['uid'])
33                 );
34                 if(!$r) {
35                         logger("diaspora photo queue: user " . $dphoto['uid'] . " not found");
36                         return;
37                 }
38
39                 $ret = diaspora_dispatch($r[0],unserialize($dphoto['msg']),$dphoto['attempt']);
40                 q("DELETE FROM dsprphotoq WHERE id = %d",
41                    intval($dphoto['id'])
42                 );
43         }
44 }
45
46
47 if (array_search(__file__,get_included_files())===0){
48   dsprphotoq_run($_SERVER["argv"],$_SERVER["argc"]);
49   killme();
50 }