Merge pull request #4031 from MrPetovan/task/3878-move-objects-to-model

Move Objects to Model
This commit is contained in:
Michael Vogel 2017-12-08 05:02:21 +01:00 committed by GitHub
commit e437c74d0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
77 changed files with 636 additions and 593 deletions

View file

@ -13,10 +13,10 @@ use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\GlobalContact;
use Friendica\Object\Contact;
use Friendica\Object\Photo;
use Friendica\Object\Profile;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Model\Profile;
use Friendica\Object\Image;
use Friendica\Protocol\OStatus;
use Friendica\Util\XML;
@ -476,7 +476,7 @@ class DFRN
$uid
);
$photos = array();
$ext = Photo::supportedTypes();
$ext = Image::supportedTypes();
foreach ($rp as $p) {
$photos[$p['scale']] = System::baseUrl().'/photo/'.$p['resource-id'].'-'.$p['scale'].'.'.$ext[$p['type']];
@ -1678,9 +1678,9 @@ class DFRN
$poco["photo"] = $author["avatar"];
$poco["hide"] = $hide;
$poco["contact-type"] = $contact["contact-type"];
$gcid = GlobalContact::update($poco);
$gcid = GContact::update($poco);
GlobalContact::link($gcid, $importer["uid"], $contact["id"]);
GContact::link($gcid, $importer["uid"], $contact["id"]);
}
return($author);

View file

@ -16,10 +16,10 @@ use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\GlobalContact;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Model\Profile;
use Friendica\Network\Probe;
use Friendica\Object\Contact;
use Friendica\Object\Profile;
use Friendica\Util\XML;
use dba;
@ -2247,9 +2247,9 @@ class Diaspora
"addr" => $author, "nick" => $nick, "keywords" => $keywords,
"hide" => !$searchable, "nsfw" => $nsfw);
$gcid = GlobalContact::update($gcontact);
$gcid = GContact::update($gcontact);
GlobalContact::link($gcid, $importer["uid"], $contact["id"]);
GContact::link($gcid, $importer["uid"], $contact["id"]);
logger("Profile of contact ".$contact["id"]." stored for user ".$importer["uid"], LOGGER_DEBUG);

View file

@ -9,10 +9,10 @@ use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\GlobalContact;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Network\Probe;
use Friendica\Object\Contact;
use Friendica\Object\Photo;
use Friendica\Object\Image;
use Friendica\Util\Lock;
use Friendica\Util\XML;
use dba;
@ -226,9 +226,9 @@ class OStatus
$contact["generation"] = 2;
$contact["hide"] = false; // OStatus contacts are never hidden
$contact["photo"] = $author["author-avatar"];
$gcid = GlobalContact::update($contact);
$gcid = GContact::update($contact);
GlobalContact::link($gcid, $contact["uid"], $contact["id"]);
GContact::link($gcid, $contact["uid"], $contact["id"]);
}
return $author;
@ -1323,7 +1323,7 @@ class OStatus
switch ($siteinfo["type"]) {
case 'photo':
$imgdata = Photo::getInfoFromURL($siteinfo["image"]);
$imgdata = Image::getInfoFromURL($siteinfo["image"]);
$attributes = array("rel" => "enclosure",
"href" => $siteinfo["image"],
"type" => $imgdata["mime"],
@ -1343,7 +1343,7 @@ class OStatus
}
if (!Config::get('system', 'ostatus_not_attach_preview') && ($siteinfo["type"] != "photo") && isset($siteinfo["image"])) {
$imgdata = Photo::getInfoFromURL($siteinfo["image"]);
$imgdata = Image::getInfoFromURL($siteinfo["image"]);
$attributes = array("rel" => "enclosure",
"href" => $siteinfo["image"],
"type" => $imgdata["mime"],

View file

@ -12,10 +12,9 @@ namespace Friendica\Protocol;
use Friendica\Core\Config;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\GlobalContact;
use Friendica\Model\GContact;
use Friendica\Model\Profile;
use Friendica\Network\Probe;
use Friendica\Object\Photo;
use Friendica\Object\Profile;
use dba;
use DOMDocument;
use DomXPath;
@ -193,10 +192,10 @@ class PortableContact
"generation" => $generation);
try {
$gcontact = GlobalContact::sanitize($gcontact);
$gcid = GlobalContact::update($gcontact);
$gcontact = GContact::sanitize($gcontact);
$gcid = GContact::update($gcontact);
GlobalContact::link($gcid, $uid, $cid, $zcid);
GContact::link($gcid, $uid, $cid, $zcid);
} catch (Exception $e) {
logger($e->getMessage(), LOGGER_DEBUG);
}
@ -425,7 +424,7 @@ class PortableContact
$contact = array_merge($contact, $noscrape);
GlobalContact::update($contact);
GContact::update($contact);
if (trim($noscrape["updated"]) != "") {
q(
@ -447,7 +446,7 @@ class PortableContact
if (!$force && !self::updateNeeded($gcontacts[0]["created"], $gcontacts[0]["updated"], $gcontacts[0]["last_failure"], $gcontacts[0]["last_contact"])) {
logger("Profile ".$profile." was last updated at ".$gcontacts[0]["updated"]." (cached)", LOGGER_DEBUG);
GlobalContact::update($contact);
GContact::update($contact);
return $gcontacts[0]["updated"];
}
@ -468,8 +467,8 @@ class PortableContact
$gcontact["server_url"] = $data["baseurl"];
try {
$gcontact = GlobalContact::sanitize($gcontact);
GlobalContact::update($gcontact);
$gcontact = GContact::sanitize($gcontact);
GContact::update($gcontact);
self::lastUpdated($data["url"], $force);
} catch (Exception $e) {
@ -495,7 +494,7 @@ class PortableContact
$contact["server_url"] = $data["baseurl"];
GlobalContact::update($contact);
GContact::update($contact);
$feedret = z_fetch_url($data["poll"]);
@ -1601,8 +1600,8 @@ class PortableContact
"generation" => $generation);
try {
$gcontact = GlobalContact::sanitize($gcontact);
GlobalContact::update($gcontact);
$gcontact = GContact::sanitize($gcontact);
GContact::update($gcontact);
} catch (Exception $e) {
logger($e->getMessage(), LOGGER_DEBUG);
}