Index: trunk/extensions/CentralAuth/CentralAuthUser.php |
— | — | @@ -521,6 +521,10 @@ |
522 | 522 | return $dbw->affectedRows() != 0; |
523 | 523 | } |
524 | 524 | |
| 525 | + /** |
| 526 | + * @param array $passwords |
| 527 | + * @return bool |
| 528 | + */ |
525 | 529 | public function storeAndMigrate( $passwords = array() ) { |
526 | 530 | $dbw = self::getCentralDB(); |
527 | 531 | $dbw->begin(); |
— | — | @@ -823,6 +827,12 @@ |
824 | 828 | return false; |
825 | 829 | } |
826 | 830 | |
| 831 | + /** |
| 832 | + * @static |
| 833 | + * @throws MWException |
| 834 | + * @param $list |
| 835 | + * @return array |
| 836 | + */ |
827 | 837 | protected static function validateList( $list ) { |
828 | 838 | $unique = array_unique( $list ); |
829 | 839 | $valid = array_intersect( $unique, self::getWikiList() ); |
— | — | @@ -835,6 +845,10 @@ |
836 | 846 | return $valid; |
837 | 847 | } |
838 | 848 | |
| 849 | + /** |
| 850 | + * @static |
| 851 | + * @return array |
| 852 | + */ |
839 | 853 | public static function getWikiList() { |
840 | 854 | global $wgLocalDatabases; |
841 | 855 | static $wikiList; |
— | — | @@ -1041,6 +1055,12 @@ |
1042 | 1056 | $this->doCrosswikiSuppression( false, $wgUser->getName(), $reason ); |
1043 | 1057 | } |
1044 | 1058 | |
| 1059 | + /** |
| 1060 | + * @param $suppress |
| 1061 | + * @param $by |
| 1062 | + * @param $reason |
| 1063 | + * @return void |
| 1064 | + */ |
1045 | 1065 | protected function doCrosswikiSuppression( $suppress, $by, $reason ) { |
1046 | 1066 | global $wgCentralAuthWikisPerSuppressJob; |
1047 | 1067 | $this->loadAttached(); |
— | — | @@ -1301,6 +1321,9 @@ |
1302 | 1322 | return $unattached; |
1303 | 1323 | } |
1304 | 1324 | |
| 1325 | + /** |
| 1326 | + * @return array |
| 1327 | + */ |
1305 | 1328 | function doListUnattached() { |
1306 | 1329 | $dbw = self::getCentralDB(); |
1307 | 1330 | |
— | — | @@ -1322,6 +1345,10 @@ |
1323 | 1346 | return $dbs; |
1324 | 1347 | } |
1325 | 1348 | |
| 1349 | + /** |
| 1350 | + * @param $wikiID |
| 1351 | + * @return void |
| 1352 | + */ |
1326 | 1353 | function addLocalName( $wikiID ) { |
1327 | 1354 | $dbw = self::getCentralDB(); |
1328 | 1355 | $this->lazyImportLocalNames(); |
— | — | @@ -1333,6 +1360,10 @@ |
1334 | 1361 | array( 'IGNORE' ) ); |
1335 | 1362 | } |
1336 | 1363 | |
| 1364 | + /** |
| 1365 | + * @param $wikiID |
| 1366 | + * @return void |
| 1367 | + */ |
1337 | 1368 | function removeLocalName( $wikiID ) { |
1338 | 1369 | $dbw = self::getCentralDB(); |
1339 | 1370 | $this->lazyImportLocalNames(); |
— | — | @@ -1343,6 +1374,9 @@ |
1344 | 1375 | __METHOD__ ); |
1345 | 1376 | } |
1346 | 1377 | |
| 1378 | + /** |
| 1379 | + * @return bool |
| 1380 | + */ |
1347 | 1381 | function lazyImportLocalNames() { |
1348 | 1382 | $dbw = self::getCentralDB(); |
1349 | 1383 | |
— | — | @@ -1588,16 +1622,26 @@ |
1589 | 1623 | return $data; |
1590 | 1624 | } |
1591 | 1625 | |
| 1626 | + /** |
| 1627 | + * @return |
| 1628 | + */ |
1592 | 1629 | function getEmail() { |
1593 | 1630 | $this->loadState(); |
1594 | 1631 | return $this->mEmail; |
1595 | 1632 | } |
1596 | 1633 | |
| 1634 | + /** |
| 1635 | + * @return |
| 1636 | + */ |
1597 | 1637 | function getEmailAuthenticationTimestamp() { |
1598 | 1638 | $this->loadState(); |
1599 | 1639 | return $this->mAuthenticationTimestamp; |
1600 | 1640 | } |
1601 | 1641 | |
| 1642 | + /** |
| 1643 | + * @param $email |
| 1644 | + * @return void |
| 1645 | + */ |
1602 | 1646 | function setEmail( $email ) { |
1603 | 1647 | $this->loadState(); |
1604 | 1648 | if ( $this->mEmail !== $email ) { |
— | — | @@ -1606,6 +1650,10 @@ |
1607 | 1651 | } |
1608 | 1652 | } |
1609 | 1653 | |
| 1654 | + /** |
| 1655 | + * @param $ts |
| 1656 | + * @return void |
| 1657 | + */ |
1610 | 1658 | function setEmailAuthenticationTimestamp( $ts ) { |
1611 | 1659 | $this->loadState(); |
1612 | 1660 | if ( $this->mAuthenticationTimestamp !== $ts ) { |
— | — | @@ -1665,6 +1713,13 @@ |
1666 | 1714 | return $this->mPassword; |
1667 | 1715 | } |
1668 | 1716 | |
| 1717 | + /** |
| 1718 | + * @static |
| 1719 | + * @param $name |
| 1720 | + * @param $value |
| 1721 | + * @param $exp |
| 1722 | + * @return void |
| 1723 | + */ |
1669 | 1724 | static function setCookie( $name, $value, $exp = -1 ) { |
1670 | 1725 | global $wgCentralAuthCookiePrefix, $wgCentralAuthCookieDomain, $wgCookieSecure, |
1671 | 1726 | $wgCookieExpiration, $wgCookieHttpOnly; |
— | — | @@ -1700,6 +1755,10 @@ |
1701 | 1756 | } |
1702 | 1757 | } |
1703 | 1758 | |
| 1759 | + /** |
| 1760 | + * @param $name |
| 1761 | + * @return void |
| 1762 | + */ |
1704 | 1763 | protected function clearCookie( $name ) { |
1705 | 1764 | self::setCookie( $name, '', - 86400 ); |
1706 | 1765 | } |
— | — | @@ -1768,6 +1827,9 @@ |
1769 | 1828 | $this->saveSettings(); |
1770 | 1829 | } |
1771 | 1830 | |
| 1831 | + /** |
| 1832 | + * @return |
| 1833 | + */ |
1772 | 1834 | function saveSettings() { |
1773 | 1835 | if ( !$this->mStateDirty ) return; |
1774 | 1836 | $this->mStateDirty = false; |
— | — | @@ -1797,12 +1859,18 @@ |
1798 | 1860 | $this->invalidateCache(); |
1799 | 1861 | } |
1800 | 1862 | |
| 1863 | + /** |
| 1864 | + * @return |
| 1865 | + */ |
1801 | 1866 | function getGlobalGroups() { |
1802 | 1867 | $this->loadGroups(); |
1803 | 1868 | |
1804 | 1869 | return $this->mGroups; |
1805 | 1870 | } |
1806 | 1871 | |
| 1872 | + /** |
| 1873 | + * @return array |
| 1874 | + */ |
1807 | 1875 | function getGlobalRights() { |
1808 | 1876 | $this->loadGroups(); |
1809 | 1877 | |
— | — | @@ -1820,6 +1888,10 @@ |
1821 | 1889 | return $rights; |
1822 | 1890 | } |
1823 | 1891 | |
| 1892 | + /** |
| 1893 | + * @param $groups |
| 1894 | + * @return void |
| 1895 | + */ |
1824 | 1896 | function removeFromGlobalGroups( $groups ) { |
1825 | 1897 | $dbw = self::getCentralDB(); |
1826 | 1898 | |
— | — | @@ -1831,6 +1903,10 @@ |
1832 | 1904 | $this->invalidateCache(); |
1833 | 1905 | } |
1834 | 1906 | |
| 1907 | + /** |
| 1908 | + * @param $groups |
| 1909 | + * @return void |
| 1910 | + */ |
1835 | 1911 | function addToGlobalGroups( $groups ) { |
1836 | 1912 | $dbw = self::getCentralDB(); |
1837 | 1913 | |
— | — | @@ -1851,6 +1927,10 @@ |
1852 | 1928 | $this->invalidateCache(); |
1853 | 1929 | } |
1854 | 1930 | |
| 1931 | + /** |
| 1932 | + * @static |
| 1933 | + * @return array |
| 1934 | + */ |
1855 | 1935 | static function availableGlobalGroups() { |
1856 | 1936 | $dbr = self::getCentralSlaveDB(); |
1857 | 1937 | |
— | — | @@ -1865,6 +1945,11 @@ |
1866 | 1946 | return $groups; |
1867 | 1947 | } |
1868 | 1948 | |
| 1949 | + /** |
| 1950 | + * @static |
| 1951 | + * @param $group |
| 1952 | + * @return array |
| 1953 | + */ |
1869 | 1954 | static function globalGroupPermissions( $group ) { |
1870 | 1955 | $dbr = self::getCentralSlaveDB(); |
1871 | 1956 | |
— | — | @@ -1880,6 +1965,10 @@ |
1881 | 1966 | return $rights; |
1882 | 1967 | } |
1883 | 1968 | |
| 1969 | + /** |
| 1970 | + * @param $perm |
| 1971 | + * @return bool |
| 1972 | + */ |
1884 | 1973 | function hasGlobalPermission( $perm ) { |
1885 | 1974 | $perms = $this->getGlobalRights(); |
1886 | 1975 | |
— | — | @@ -1901,6 +1990,9 @@ |
1902 | 1991 | return $rights; |
1903 | 1992 | } |
1904 | 1993 | |
| 1994 | + /** |
| 1995 | + * @return void |
| 1996 | + */ |
1905 | 1997 | public function invalidateCache() { |
1906 | 1998 | if ( !$this->mDelayInvalidation ) { |
1907 | 1999 | wfDebugLog( 'CentralAuth', "Updating cache for global user {$this->mName}" ); |
— | — | @@ -1950,6 +2042,10 @@ |
1951 | 2043 | $this->mDelayInvalidation = 1; |
1952 | 2044 | } |
1953 | 2045 | |
| 2046 | + /** |
| 2047 | + * @static |
| 2048 | + * @return string |
| 2049 | + */ |
1954 | 2050 | static function memcKey( /*...*/ ) { |
1955 | 2051 | global $wgCentralAuthDatabase; |
1956 | 2052 | $args = func_get_args(); |