@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

quick, ghetto script to rescale profile pictures

Summary: we had a hole in scaling pics from oauth from a bit. that was patched in D2848. this cleans up the old data.

Test Plan: ran it in production. issue as described on task is resolved. also spot checked some profiles and they look good.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1634

Differential Revision: https://secure.phabricator.com/D3268

+57
+57
scripts/profile/rescale_all_user_pics.php
··· 1 + #!/usr/bin/env php 2 + <?php 3 + 4 + /* 5 + * Copyright 2012 Facebook, Inc. 6 + * 7 + * Licensed under the Apache License, Version 2.0 (the "License"); 8 + * you may not use this file except in compliance with the License. 9 + * You may obtain a copy of the License at 10 + * 11 + * http://www.apache.org/licenses/LICENSE-2.0 12 + * 13 + * Unless required by applicable law or agreed to in writing, software 14 + * distributed under the License is distributed on an "AS IS" BASIS, 15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 + * See the License for the specific language governing permissions and 17 + * limitations under the License. 18 + */ 19 + 20 + $root = dirname(dirname(dirname(__FILE__))); 21 + require_once $root.'/scripts/__init_script__.php'; 22 + 23 + echo "Examining users.\n"; 24 + foreach (new LiskMigrationIterator(new PhabricatorUser()) as $user) { 25 + $file = id(new PhabricatorFile()) 26 + ->loadOneWhere('phid = %s', $user->getProfileImagePHID()); 27 + 28 + if (!$file) { 29 + echo 'No pic for user ', $user->getUserName(), "\n"; 30 + continue; 31 + } 32 + 33 + $data = $file->loadFileData(); 34 + $img = imagecreatefromstring($data); 35 + $sx = imagesx($img); 36 + $sy = imagesy($img); 37 + 38 + if ($sx != 50 || $sy != 50) { 39 + echo 'Found one! User ', $user->getUserName(), "\n"; 40 + $xformer = new PhabricatorImageTransformer(); 41 + 42 + // Resize OAuth image to a reasonable size 43 + $small_xformed = $xformer->executeProfileTransform( 44 + $file, 45 + $width = 50, 46 + $min_height = 50, 47 + $max_height = 50); 48 + 49 + $user->setProfileImagePHID($small_xformed->getPHID()); 50 + $user->save(); 51 + break; 52 + } else { 53 + echo '.'; 54 + } 55 + } 56 + echo "\n"; 57 + echo "Done.\n";