* - forceChange (bool): if set to true, the user should not be
* allowed to log with this password unless they change it during
* the login process (see ResetPasswordSecondaryAuthenticationProvider).
+ * - suggestChangeOnLogin (bool): if set to true, the user should be prompted for
+ * a password change on login.
*
* @param string $password Desired password
* @return Status
Hooks::run( 'UserSaveSettings', [ $this ] );
$this->clearSharedCache();
- $this->getUserPage()->invalidateCache();
+ $this->getUserPage()->purgeSquid();
}
/**
* non-existent/anonymous user accounts.
*/
public function getFirstEditTimestamp() {
+ return $this->getEditTimestamp( true );
+ }
+
+ /**
+ * Get the timestamp of the latest edit
+ *
+ * @since 1.33
+ * @return string|bool Timestamp of first edit, or false for
+ * non-existent/anonymous user accounts.
+ */
+ public function getLatestEditTimestamp() {
+ return $this->getEditTimestamp( false );
+ }
+
+ /**
+ * Get the timestamp of the first or latest edit
+ *
+ * @param bool $first True for the first edit, false for the latest one
+ * @return string|bool Timestamp of first or latest edit, or false for
+ * non-existent/anonymous user accounts.
+ */
+ private function getEditTimestamp( $first ) {
if ( $this->getId() == 0 ) {
return false; // anons
}
$actorWhere = ActorMigration::newMigration()->getWhere( $dbr, 'rev_user', $this );
$tsField = isset( $actorWhere['tables']['temp_rev_user'] )
? 'revactor_timestamp' : 'rev_timestamp';
+ $sortOrder = $first ? 'ASC' : 'DESC';
$time = $dbr->selectField(
[ 'revision' ] + $actorWhere['tables'],
$tsField,
[ $actorWhere['conds'] ],
__METHOD__,
- [ 'ORDER BY' => "$tsField ASC" ],
+ [ 'ORDER BY' => "$tsField $sortOrder" ],
$actorWhere['joins']
);
if ( !$time ) {