Page MenuHomePhabricator
Paste P1166

emailprefs.php
ActivePublic

Authored by epriestley on May 29 2014, 6:17 PM.
Tags
None
Referenced Files
F162031: newprefs.php
May 29 2014, 6:17 PM
Subscribers
None
<?php
// Put this in `phabricator/` and run it as `php -f emailprefs.php`.
require_once 'scripts/__init_script__.php';
$user_table = new PhabricatorUser();
foreach (new LiskMigrationIterator($user_table) as $user) {
$username = $user->getUsername();
$preferences = $user->loadPreferences();
$mail_preferences = $preferences->getPreference('mailtags');
if ($mail_preferences) {
echo "User {$username} already has preferences, declining to overwrite.\n";
continue;
}
$new_mail_preference = array(
MetaMTANotificationType::TYPE_MANIPHEST_CC => false,
MetaMTANotificationType::TYPE_DIFFERENTIAL_CC => false,
);
$preferences->setPreference('mailtags', $new_mail_preference);
echo "Updating preferences for {$username}.\n";
// Uncomment this to actually have an effect.
// $preferences->save();
}

Event Timeline

epriestley changed the title of this paste from untitled to newprefs.php.
epriestley updated the paste's language from autodetect to autodetect.
epriestley changed the title of this paste from newprefs.php to emailprefs.php.