<?php
-define('UPDATE_VERSION' , 1235);
+define('UPDATE_VERSION' , 1236);
use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
+use Friendica\Model\Photo;
+use Friendica\Object\Image;
/**
*
* The DB_UPDATE_VERSION will always be one greater than the last numbered script in this file.
*
* If you change the database schema, the following are required:
- * 1. Update the file include/dbstructure.php to match the new schema.
+ * 1. Update the file src/Database/DBStructure.php to match the new schema.
* 2. If there is a need for a post procession, update this file by adding a new function at the end with the number of the current DB_UPDATE_VERSION.
* This function should perform some post procession steps but no database updates.
* 3. Increment the DB_UPDATE_VERSION in boot.php *AND* the UPDATE_VERSION in this file to match it
* 4. TEST the upgrade prior to checkin and filing a pull request.
*
* IMPORTANT!
- * NEVER do a database change anymore in the update functions! Only do this in the file include/dbstructure.php!
+ * NEVER do a database change anymore in the update functions! Only do this in the file src/Database/DBStructure.php!
*/
AFTER `object` , ADD `target` TEXT NOT NULL AFTER `target-type`");
}
-function update_1014() {
- require_once('include/Photo.php');
+function update_1014()
+{
q("ALTER TABLE `contact` ADD `micro` TEXT NOT NULL AFTER `thumb` ");
$r = q("SELECT * FROM `photo` WHERE `scale` = 4");
if (DBM::is_result($r)) {
foreach ($r as $rr) {
- $ph = new Photo($rr['data']);
- if ($ph->is_valid()) {
- $ph->scaleImage(48);
- $ph->store($rr['uid'],$rr['contact-id'],$rr['resource-id'],$rr['filename'],$rr['album'],6,(($rr['profile']) ? 1 : 0));
+ $Image = new Image($rr['data']);
+ if ($Image->isValid()) {
+ $Image->scaleDown(48);
+ Photo::store($Image, $rr['uid'],$rr['contact-id'],$rr['resource-id'],$rr['filename'],$rr['album'],6,(($rr['profile']) ? 1 : 0));
}
}
}
foreach ($r as $rr) {
$found = true;
do {
- $guid = substr(random_string(),0,16);
+ $guid = random_string(16);
$x = q("SELECT `uid` FROM `user` WHERE `guid` = '%s' LIMIT 1",
dbesc($guid)
);
$r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
NETWORK_DFRN, NETWORK_DFRN);
- $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
- NETWORK_ZOT, NETWORK_ZOT);
-
$r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
NETWORK_OSTATUS, NETWORK_OSTATUS);
$r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
NETWORK_MAIL, NETWORK_MAIL);
- $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
- NETWORK_MAIL2, NETWORK_MAIL2);
-
$r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
NETWORK_FACEBOOK, NETWORK_FACEBOOK);
All following update functions are ONLY for jobs that need to run AFTER the database changes are applied.
-Database changes are ONLY applied in the file include/dbstructure.php.
+Database changes are ONLY applied in the file src/Database/DBStructure.php.
*/
function update_1177() {