fix contact photo updates - a result of baseurl being wrong for cmdline processes
This commit is contained in:
parent
147d7f3bbf
commit
b96d6c015b
40
boot.php
40
boot.php
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
|
||||||
define ( 'BUILD_ID', 1036 );
|
define ( 'BUILD_ID', 1037 );
|
||||||
define ( 'FRIENDIKA_VERSION', '2.10.0905' );
|
define ( 'FRIENDIKA_VERSION', '2.10.0905' );
|
||||||
define ( 'DFRN_PROTOCOL_VERSION', '2.1' );
|
define ( 'DFRN_PROTOCOL_VERSION', '2.1' );
|
||||||
|
|
||||||
|
@ -215,9 +215,19 @@ class App {
|
||||||
|
|
||||||
$this->scheme = ((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'])) ? 'https' : 'http' );
|
$this->scheme = ((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'])) ? 'https' : 'http' );
|
||||||
|
|
||||||
if(x($_SERVER,'SERVER_NAME'))
|
if(x($_SERVER,'SERVER_NAME')) {
|
||||||
$this->hostname = $_SERVER['SERVER_NAME'];
|
$this->hostname = $_SERVER['SERVER_NAME'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Figure out if we are running at the top of a domain
|
||||||
|
* or in a sub-directory and adjust accordingly
|
||||||
|
*/
|
||||||
|
|
||||||
|
$path = trim(dirname($_SERVER['SCRIPT_NAME']),'/\\');
|
||||||
|
if(isset($path) && strlen($path) && ($path != $this->path))
|
||||||
|
$this->path = $path;
|
||||||
|
}
|
||||||
|
|
||||||
set_include_path("include/$this->hostname" . PATH_SEPARATOR . 'include' . PATH_SEPARATOR . '.' );
|
set_include_path("include/$this->hostname" . PATH_SEPARATOR . 'include' . PATH_SEPARATOR . '.' );
|
||||||
|
|
||||||
if((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'],0,2) === "q=")
|
if((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'],0,2) === "q=")
|
||||||
|
@ -225,14 +235,6 @@ class App {
|
||||||
if(x($_GET,'q'))
|
if(x($_GET,'q'))
|
||||||
$this->cmd = trim($_GET['q'],'/\\');
|
$this->cmd = trim($_GET['q'],'/\\');
|
||||||
|
|
||||||
/**
|
|
||||||
* Figure out if we are running at the top of a domain
|
|
||||||
* or in a sub-directory and adjust accordingly
|
|
||||||
*/
|
|
||||||
|
|
||||||
$path = trim(dirname($_SERVER['SCRIPT_NAME']),'/\\');
|
|
||||||
if(isset($path) && strlen($path) && ($path != $this->path))
|
|
||||||
$this->path = $path;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -295,8 +297,20 @@ class App {
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_baseurl($url) {
|
function set_baseurl($url) {
|
||||||
|
$parsed = parse_url($url);
|
||||||
|
|
||||||
$this->baseurl = $url;
|
$this->baseurl = $url;
|
||||||
$this->hostname = basename($url);
|
|
||||||
|
if($parsed) {
|
||||||
|
$this->scheme = $parsed['scheme'];
|
||||||
|
|
||||||
|
$this->hostname = $parsed['host'];
|
||||||
|
if($parsed['port'])
|
||||||
|
$this->hostname .= ':' . $parsed['port'];
|
||||||
|
if($parsed['path'])
|
||||||
|
$this->path = trim($parsed['path'],'\\/');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_hostname() {
|
function get_hostname() {
|
||||||
|
@ -406,8 +420,12 @@ function system_unavailable() {
|
||||||
if(! function_exists('check_config')) {
|
if(! function_exists('check_config')) {
|
||||||
function check_config(&$a) {
|
function check_config(&$a) {
|
||||||
|
|
||||||
|
|
||||||
load_config('system');
|
load_config('system');
|
||||||
|
|
||||||
|
if(! x($_SERVER,'SERVER_NAME'))
|
||||||
|
return;
|
||||||
|
|
||||||
$build = get_config('system','build');
|
$build = get_config('system','build');
|
||||||
if(! x($build))
|
if(! x($build))
|
||||||
$build = set_config('system','build',BUILD_ID);
|
$build = set_config('system','build',BUILD_ID);
|
||||||
|
|
|
@ -28,7 +28,6 @@ function poller_run($argv, $argc){
|
||||||
// run queue delivery process in the background
|
// run queue delivery process in the background
|
||||||
|
|
||||||
$php_path = ((x($a->config,'php_path') && strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
|
$php_path = ((x($a->config,'php_path') && strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
|
||||||
//proc_close(proc_open("\"$php_path\" \"include/queue.php\" &", array(), $foo));
|
|
||||||
proc_run($php_path,"include/queue.php");
|
proc_run($php_path,"include/queue.php");
|
||||||
|
|
||||||
// clear old cache
|
// clear old cache
|
||||||
|
|
16
update.php
16
update.php
|
@ -348,4 +348,18 @@ function update_1035() {
|
||||||
|
|
||||||
q("ALTER TABLE `contact` ADD `success_update` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `last-update` ");
|
q("ALTER TABLE `contact` ADD `success_update` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `last-update` ");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_1036() {
|
||||||
|
|
||||||
|
$r = dbq("SELECT * FROM `contact` WHERE `network` = 'dfrn' && `photo` LIKE '%include/photo%' ");
|
||||||
|
if(count($r)) {
|
||||||
|
foreach($r as $rr) {
|
||||||
|
q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `micro` = '%s' WHERE `id` = %d LIMIT 1",
|
||||||
|
dbesc(str_replace('include/photo','photo',$rr['photo'])),
|
||||||
|
dbesc(str_replace('include/photo','photo',$rr['thumb'])),
|
||||||
|
dbesc(str_replace('include/photo','photo',$rr['micro'])),
|
||||||
|
intval($rr['id']));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user