1b5284271SAndreas Gohr<?php 2b5284271SAndreas Gohr 3b5284271SAndreas Gohrnamespace dokuwiki\Remote; 4b5284271SAndreas Gohr 5b5284271SAndreas Gohruse dokuwiki\Utf8\PhpString; 6*15357ce4SAndreas Gohruse IXR\DataType\Base64; 7b5284271SAndreas Gohruse IXR\DataType\Date; 8b5284271SAndreas Gohr 9b5284271SAndreas Gohr/** 10b5284271SAndreas Gohr * Provides wrappers for the API calls as they existed in API Version 11 11b5284271SAndreas Gohr * 12b5284271SAndreas Gohr * No guarantees are made about the exact compatibility of the return values. 13b5284271SAndreas Gohr * 14b5284271SAndreas Gohr * @deprecated 15b5284271SAndreas Gohr */ 16b5284271SAndreas Gohrclass LegacyApiCore extends ApiCore 17b5284271SAndreas Gohr{ 18b5284271SAndreas Gohr /** @inheritdoc */ 19b5284271SAndreas Gohr public function getMethods() 20b5284271SAndreas Gohr { 21b5284271SAndreas Gohr $methods = parent::getMethods(); 22b5284271SAndreas Gohr 23b5284271SAndreas Gohr return array_merge( 24b5284271SAndreas Gohr $methods, 25b5284271SAndreas Gohr [ 26b5284271SAndreas Gohr 'dokuwiki.getVersion' => new ApiCall([$this, 'legacyGetVersion'], 'legacy'), 27b5284271SAndreas Gohr 'dokuwiki.login' => (new ApiCall([$this, 'legacyLogin'], 'legacy'))->setPublic(), 28b5284271SAndreas Gohr 'dokuwiki.logoff' => new ApiCall([$this, 'legacyLogoff'], 'legacy'), 29b5284271SAndreas Gohr 'dokuwiki.getPagelist' => new ApiCall([$this, 'legacyGetPagelist'], 'legacy'), 30b5284271SAndreas Gohr 'dokuwiki.search' => new ApiCall([$this, 'legacySearch'], 'legacy'), 31b5284271SAndreas Gohr 'dokuwiki.getTime' => new ApiCall([$this, 'legacyGetTime'], 'legacy'), 32b5284271SAndreas Gohr 'dokuwiki.setLocks' => new ApiCall([$this, 'legacySetLocks'], 'legacy'), 33b5284271SAndreas Gohr 'dokuwiki.getTitle' => (new ApiCall([$this, 'legacyGetTitle'], 'legacy'))->setPublic(), 34b5284271SAndreas Gohr 'dokuwiki.appendPage' => new ApiCall([$this, 'legacyAppendPage'], 'legacy'), 35b5284271SAndreas Gohr 'dokuwiki.createUser' => new ApiCall([$this, 'legacyCreateUser'], 'legacy'), 36b5284271SAndreas Gohr 'dokuwiki.deleteUsers' => new ApiCall([$this, 'legacyDeleteUsers'], 'legacy'), 37b5284271SAndreas Gohr 'wiki.getPage' => new ApiCall([$this, 'legacyGetPage'], 'legacy'), 38b5284271SAndreas Gohr 'wiki.getPageVersion' => new ApiCall([$this, 'legacyGetPageVersion'], 'legacy'), 39b5284271SAndreas Gohr 'wiki.getPageHTML' => new ApiCall([$this, 'legacyGetPageHTML'], 'legacy'), 40b5284271SAndreas Gohr 'wiki.getPageHTMLVersion' => new ApiCall([$this, 'legacyGetPageHTMLVersion'], 'legacy'), 41b5284271SAndreas Gohr 'wiki.getAllPages' => new ApiCall([$this, 'legacyGetAllPages'], 'legacy'), 42b5284271SAndreas Gohr 'wiki.getAttachments' => new ApiCall([$this, 'legacyGetAttachments'], 'legacy'), 43b5284271SAndreas Gohr 'wiki.getBackLinks' => new ApiCall([$this, 'legacyGetBackLinks'], 'legacy'), 44b5284271SAndreas Gohr 'wiki.getPageInfo' => new ApiCall([$this, 'legacyGetPageInfo'], 'legacy'), 45b5284271SAndreas Gohr 'wiki.getPageInfoVersion' => new ApiCall([$this, 'legacyGetPageInfoVersion'], 'legacy'), 46b5284271SAndreas Gohr 'wiki.getPageVersions' => new ApiCall([$this, 'legacyGetPageVersions'], 'legacy'), 47b5284271SAndreas Gohr 'wiki.putPage' => new ApiCall([$this, 'legacyPutPage'], 'legacy'), 48b5284271SAndreas Gohr 'wiki.listLinks' => new ApiCall([$this, 'legacyListLinks'], 'legacy'), 49b5284271SAndreas Gohr 'wiki.getRecentChanges' => new ApiCall([$this, 'legacyGetRecentChanges'], 'legacy'), 50b5284271SAndreas Gohr 'wiki.getRecentMediaChanges' => new ApiCall([$this, 'legacyGetRecentMediaChanges'], 'legacy'), 51b5284271SAndreas Gohr 'wiki.aclCheck' => new ApiCall([$this, 'legacyAclCheck'], 'legacy'), 52b5284271SAndreas Gohr 'wiki.putAttachment' => new ApiCall([$this, 'legacyPutAttachment'], 'legacy'), 53b5284271SAndreas Gohr 'wiki.deleteAttachment' => new ApiCall([$this, 'legacyDeleteAttachment'], 'legacy'), 54b5284271SAndreas Gohr 'wiki.getAttachment' => new ApiCall([$this, 'legacyGetAttachment'], 'legacy'), 55b5284271SAndreas Gohr 'wiki.getAttachmentInfo' => new ApiCall([$this, 'legacyGetAttachmentInfo'], 'legacy'), 56b5284271SAndreas Gohr 'dokuwiki.getXMLRPCAPIVersion' => (new ApiCall([$this, 'legacyGetXMLRPCAPIVersion'], 'legacy')) 57b5284271SAndreas Gohr ->setPublic(), 58b5284271SAndreas Gohr 'wiki.getRPCVersionSupported' => (new ApiCall([$this, 'legacyGetRPCVersionSupported'], 'legacy')) 59b5284271SAndreas Gohr ->setPublic(), 60b5284271SAndreas Gohr ] 61b5284271SAndreas Gohr ); 62b5284271SAndreas Gohr } 63b5284271SAndreas Gohr 64b5284271SAndreas Gohr /** 65b5284271SAndreas Gohr * This returns a XMLRPC object that will not work for the new JSONRPC API 66b5284271SAndreas Gohr * 67b5284271SAndreas Gohr * @param int $ts 68b5284271SAndreas Gohr * @return Date 69b5284271SAndreas Gohr */ 70b5284271SAndreas Gohr protected function toDate($ts) 71b5284271SAndreas Gohr { 72b5284271SAndreas Gohr return new Date($ts); 73b5284271SAndreas Gohr } 74b5284271SAndreas Gohr 75b5284271SAndreas Gohr 76b5284271SAndreas Gohr /** 77b5284271SAndreas Gohr * @deprecated use core.getWikiVersion instead 78b5284271SAndreas Gohr */ 79b5284271SAndreas Gohr public function legacyGetVersion() 80b5284271SAndreas Gohr { 81b5284271SAndreas Gohr return getVersion(); 82b5284271SAndreas Gohr } 83b5284271SAndreas Gohr 84b5284271SAndreas Gohr /** 85b5284271SAndreas Gohr * @deprecated use core.getWikiTime instead 86b5284271SAndreas Gohr */ 87b5284271SAndreas Gohr public function legacyGetTime() 88b5284271SAndreas Gohr { 89b5284271SAndreas Gohr return $this->getWikiTime(); 90b5284271SAndreas Gohr } 91b5284271SAndreas Gohr 92b5284271SAndreas Gohr 93b5284271SAndreas Gohr /** 94b5284271SAndreas Gohr * @deprecated use core.getPage instead 95b5284271SAndreas Gohr */ 96b5284271SAndreas Gohr public function legacyGetPage($id) 97b5284271SAndreas Gohr { 98b5284271SAndreas Gohr return $this->getPage($id); 99b5284271SAndreas Gohr } 100b5284271SAndreas Gohr 101b5284271SAndreas Gohr /** 102b5284271SAndreas Gohr * @deprecated use core.getPage instead 103b5284271SAndreas Gohr */ 104b5284271SAndreas Gohr public function legacyGetPageVersion($id, $rev = '') 105b5284271SAndreas Gohr { 106b5284271SAndreas Gohr return $this->getPage($id, $rev); 107b5284271SAndreas Gohr } 108b5284271SAndreas Gohr 109b5284271SAndreas Gohr /** 110b5284271SAndreas Gohr * @deprecated use core.getMedia instead 111b5284271SAndreas Gohr */ 112b5284271SAndreas Gohr public function legacyGetAttachment($id) 113b5284271SAndreas Gohr { 114*15357ce4SAndreas Gohr return new Base64(base64_decode($this->getMedia($id))); 115b5284271SAndreas Gohr } 116b5284271SAndreas Gohr 117b5284271SAndreas Gohr /** 118b5284271SAndreas Gohr * @deprecated use core.getMediaInfo instead 119b5284271SAndreas Gohr */ 120b5284271SAndreas Gohr public function legacygetAttachmentInfo($id) 121b5284271SAndreas Gohr { 122b5284271SAndreas Gohr $info = $this->getMediaInfo($id); 123b5284271SAndreas Gohr return [ 124b5284271SAndreas Gohr 'lastModified' => $this->toDate($info->revision), 125b5284271SAndreas Gohr 'size' => $info->size, 126b5284271SAndreas Gohr ]; 127b5284271SAndreas Gohr } 128b5284271SAndreas Gohr 129b5284271SAndreas Gohr /** 130b5284271SAndreas Gohr * @deprecated use core.getPageHTML instead 131b5284271SAndreas Gohr */ 132b5284271SAndreas Gohr public function legacyGetPageHTML($id) 133b5284271SAndreas Gohr { 134b5284271SAndreas Gohr return $this->getPageHTML($id); 135b5284271SAndreas Gohr } 136b5284271SAndreas Gohr 137b5284271SAndreas Gohr /** 138b5284271SAndreas Gohr * @deprecated use core.getPageHTML instead 139b5284271SAndreas Gohr */ 140b5284271SAndreas Gohr public function legacyGetPageHTMLVersion($id, $rev = '') 141b5284271SAndreas Gohr { 142b5284271SAndreas Gohr return $this->getPageHTML($id, (int)$rev); 143b5284271SAndreas Gohr } 144b5284271SAndreas Gohr 145b5284271SAndreas Gohr /** 146b5284271SAndreas Gohr * @deprecated use core.listPages instead 147b5284271SAndreas Gohr */ 148b5284271SAndreas Gohr public function legacyGetAllPages() 149b5284271SAndreas Gohr { 150b5284271SAndreas Gohr $pages = $this->listPages('', 0); 151b5284271SAndreas Gohr 152b5284271SAndreas Gohr $result = []; 153b5284271SAndreas Gohr foreach ($pages as $page) { 154b5284271SAndreas Gohr $result[] = [ 155b5284271SAndreas Gohr 'id' => $page->id, 156b5284271SAndreas Gohr 'perms' => $page->permission, 157b5284271SAndreas Gohr 'size' => $page->size, 158b5284271SAndreas Gohr 'lastModified' => $this->toDate($page->revision), 159b5284271SAndreas Gohr ]; 160b5284271SAndreas Gohr } 161b5284271SAndreas Gohr return $result; 162b5284271SAndreas Gohr } 163b5284271SAndreas Gohr 164b5284271SAndreas Gohr /** 165b5284271SAndreas Gohr * @deprecated use core.listPages instead 166b5284271SAndreas Gohr */ 167b5284271SAndreas Gohr public function legacyGetPagelist($ns, $opts = []) 168b5284271SAndreas Gohr { 169b5284271SAndreas Gohr $data = $this->listPages($ns, $opts['depth'] ?? 0, $opts['hash'] ?? false); 170b5284271SAndreas Gohr $result = []; 171b5284271SAndreas Gohr 172b5284271SAndreas Gohr foreach ($data as $page) { 173b5284271SAndreas Gohr $result[] = [ 174b5284271SAndreas Gohr 'id' => $page->id, 175b5284271SAndreas Gohr 'perms' => $page->permission, 176b5284271SAndreas Gohr 'size' => $page->size, 177b5284271SAndreas Gohr 'rev' => $page->revision, 178b5284271SAndreas Gohr 'lastModified' => $this->toDate($page->revision), 179b5284271SAndreas Gohr 'hash' => $page->hash, 180b5284271SAndreas Gohr 181b5284271SAndreas Gohr ]; 182b5284271SAndreas Gohr } 183b5284271SAndreas Gohr 184b5284271SAndreas Gohr return $result; 185b5284271SAndreas Gohr } 186b5284271SAndreas Gohr 187b5284271SAndreas Gohr /** 188b5284271SAndreas Gohr * @deprecated use core.searchPages instead 189b5284271SAndreas Gohr */ 190b5284271SAndreas Gohr public function legacySearch($query) 191b5284271SAndreas Gohr { 192b5284271SAndreas Gohr $this->searchPages($query); 193b5284271SAndreas Gohr $pages = []; 194b5284271SAndreas Gohr 195b5284271SAndreas Gohr foreach ($this->searchPages($query) as $page) { 196b5284271SAndreas Gohr $pages[] = [ 197b5284271SAndreas Gohr 'id' => $page->id, 198b5284271SAndreas Gohr 'score' => $page->score, 199b5284271SAndreas Gohr 'rev' => $page->revision, 200b5284271SAndreas Gohr 'lastModified' => $this->toDate($page->revision), 201b5284271SAndreas Gohr 'size' => $page->size, 202b5284271SAndreas Gohr 'snippet' => $page->snippet, 203b5284271SAndreas Gohr 'title' => $page->title 204b5284271SAndreas Gohr ]; 205b5284271SAndreas Gohr } 206b5284271SAndreas Gohr 207b5284271SAndreas Gohr return $pages; 208b5284271SAndreas Gohr } 209b5284271SAndreas Gohr 210b5284271SAndreas Gohr /** 211b5284271SAndreas Gohr * @deprecated use core.getWikiTitle instead 212b5284271SAndreas Gohr */ 213b5284271SAndreas Gohr public function legacyGetTitle() 214b5284271SAndreas Gohr { 215b5284271SAndreas Gohr return $this->getWikiTitle(); 216b5284271SAndreas Gohr } 217b5284271SAndreas Gohr 218b5284271SAndreas Gohr /** 219b5284271SAndreas Gohr * @deprecated use core.listMedia instead 220b5284271SAndreas Gohr */ 221b5284271SAndreas Gohr public function legacyGetAttachments($ns, $options = []) 222b5284271SAndreas Gohr { 223b5284271SAndreas Gohr $files = $this->listMedia($ns, $options['pattern'] ?? '', $options['depth'] ?? 0, $options['hash'] ?? false); 224b5284271SAndreas Gohr $result = []; 225b5284271SAndreas Gohr foreach ($files as $file) { 226b5284271SAndreas Gohr $result[] = [ 227b5284271SAndreas Gohr 'id' => $file->id, 228b5284271SAndreas Gohr 'perms' => $file->permission, 229b5284271SAndreas Gohr 'size' => $file->size, 230b5284271SAndreas Gohr 'rev' => $file->revision, 231b5284271SAndreas Gohr 'lastModified' => $this->toDate($file->revision), 232b5284271SAndreas Gohr 'mtime' => $this->toDate($file->revision), 233b5284271SAndreas Gohr 'hash' => $file->hash, 234b5284271SAndreas Gohr 'file' => PhpString::basename(mediaFN($file->id)), 235b5284271SAndreas Gohr 'writable' => is_writable(mediaFN($file->id)), 236b5284271SAndreas Gohr 'isimg' => $file->isimage, 237b5284271SAndreas Gohr 238b5284271SAndreas Gohr ]; 239b5284271SAndreas Gohr } 240b5284271SAndreas Gohr return $result; 241b5284271SAndreas Gohr } 242b5284271SAndreas Gohr 243b5284271SAndreas Gohr /** 244b5284271SAndreas Gohr * @deprecated use core.getPageBackLinks instead 245b5284271SAndreas Gohr */ 246b5284271SAndreas Gohr public function legacyGetBackLinks($id) 247b5284271SAndreas Gohr { 248b5284271SAndreas Gohr return $this->getPageBackLinks($id); 249b5284271SAndreas Gohr } 250b5284271SAndreas Gohr 251b5284271SAndreas Gohr /** 252b5284271SAndreas Gohr * @deprecated use core.getPageInfo instead 253b5284271SAndreas Gohr */ 254b5284271SAndreas Gohr public function legacyGetPageInfo($id) 255b5284271SAndreas Gohr { 256b5284271SAndreas Gohr $info = $this->getPageInfo($id, 0); 257b5284271SAndreas Gohr return [ 258b5284271SAndreas Gohr 'name' => $info->id, 259b5284271SAndreas Gohr 'lastModified' => $this->toDate($info->revision), 260b5284271SAndreas Gohr 'author' => $info->author, 261b5284271SAndreas Gohr 'version' => $info->revision, 262b5284271SAndreas Gohr ]; 263b5284271SAndreas Gohr } 264b5284271SAndreas Gohr 265b5284271SAndreas Gohr /** 266b5284271SAndreas Gohr * @deprecated use core.getPageInfo instead 267b5284271SAndreas Gohr */ 268b5284271SAndreas Gohr public function legacyGetPageInfoVersion($id, $rev = '') 269b5284271SAndreas Gohr { 270b5284271SAndreas Gohr $info = $this->getPageInfo($id, $rev); 271b5284271SAndreas Gohr return [ 272b5284271SAndreas Gohr 'name' => $info->id, 273b5284271SAndreas Gohr 'lastModified' => $this->toDate($info->revision), 274b5284271SAndreas Gohr 'author' => $info->author, 275b5284271SAndreas Gohr 'version' => $info->revision, 276b5284271SAndreas Gohr ]; 277b5284271SAndreas Gohr } 278b5284271SAndreas Gohr 279b5284271SAndreas Gohr /** 280b5284271SAndreas Gohr * @deprecated use core.savePage instead 281b5284271SAndreas Gohr */ 282b5284271SAndreas Gohr public function legacyPutPage($id, $text, $params = []) 283b5284271SAndreas Gohr { 284b5284271SAndreas Gohr return $this->savePage($id, $text, $params['sum'] ?? '', $params['minor'] ?? false); 285b5284271SAndreas Gohr } 286b5284271SAndreas Gohr 287b5284271SAndreas Gohr /** 288b5284271SAndreas Gohr * @deprecated use core.appendPage instead 289b5284271SAndreas Gohr */ 290b5284271SAndreas Gohr public function legacyAppendPage($id, $text, $params = []) 291b5284271SAndreas Gohr { 292b5284271SAndreas Gohr $ok = $this->appendPage($id, $text, $params['summary'] ?? '', $params['minor'] ?? false); 293b5284271SAndreas Gohr if ($ok === true) { 294b5284271SAndreas Gohr return cleanID($id); 295b5284271SAndreas Gohr } else { 296b5284271SAndreas Gohr return $ok; 297b5284271SAndreas Gohr } 298b5284271SAndreas Gohr } 299b5284271SAndreas Gohr 300b5284271SAndreas Gohr /** 301b5284271SAndreas Gohr * @deprecated use plugin.usermanager.createUser instead 302b5284271SAndreas Gohr */ 303b5284271SAndreas Gohr public function legacyCreateUser($userStruct) 304b5284271SAndreas Gohr { 305b5284271SAndreas Gohr if (!auth_isadmin()) { 306b5284271SAndreas Gohr throw new AccessDeniedException('Only admins are allowed to create users', 114); 307b5284271SAndreas Gohr } 308b5284271SAndreas Gohr 309b5284271SAndreas Gohr /** @var AuthPlugin $auth */ 310b5284271SAndreas Gohr global $auth; 311b5284271SAndreas Gohr 312b5284271SAndreas Gohr if (!$auth->canDo('addUser')) { 313b5284271SAndreas Gohr throw new AccessDeniedException( 314b5284271SAndreas Gohr sprintf('Authentication backend %s can\'t do addUser', $auth->getPluginName()), 315b5284271SAndreas Gohr 114 316b5284271SAndreas Gohr ); 317b5284271SAndreas Gohr } 318b5284271SAndreas Gohr 319b5284271SAndreas Gohr $user = trim($auth->cleanUser($userStruct['user'] ?? '')); 320b5284271SAndreas Gohr $password = $userStruct['password'] ?? ''; 321b5284271SAndreas Gohr $name = trim(preg_replace('/[\x00-\x1f:<>&%,;]+/', '', $userStruct['name'] ?? '')); 322b5284271SAndreas Gohr $mail = trim(preg_replace('/[\x00-\x1f:<>&%,;]+/', '', $userStruct['mail'] ?? '')); 323b5284271SAndreas Gohr $groups = $userStruct['groups'] ?? []; 324b5284271SAndreas Gohr 325b5284271SAndreas Gohr $notify = (bool)$userStruct['notify'] ?? false; 326b5284271SAndreas Gohr 327b5284271SAndreas Gohr if ($user === '') throw new RemoteException('empty or invalid user', 401); 328b5284271SAndreas Gohr if ($name === '') throw new RemoteException('empty or invalid user name', 402); 329b5284271SAndreas Gohr if (!mail_isvalid($mail)) throw new RemoteException('empty or invalid mail address', 403); 330b5284271SAndreas Gohr 331b5284271SAndreas Gohr if ((string)$password === '') { 332b5284271SAndreas Gohr $password = auth_pwgen($user); 333b5284271SAndreas Gohr } 334b5284271SAndreas Gohr 335b5284271SAndreas Gohr if (!is_array($groups) || $groups === []) { 336b5284271SAndreas Gohr $groups = null; 337b5284271SAndreas Gohr } 338b5284271SAndreas Gohr 339b5284271SAndreas Gohr $ok = $auth->triggerUserMod('create', [$user, $password, $name, $mail, $groups]); 340b5284271SAndreas Gohr 341b5284271SAndreas Gohr if ($ok !== false && $ok !== null) { 342b5284271SAndreas Gohr $ok = true; 343b5284271SAndreas Gohr } 344b5284271SAndreas Gohr 345b5284271SAndreas Gohr if ($ok) { 346b5284271SAndreas Gohr if ($notify) { 347b5284271SAndreas Gohr auth_sendPassword($user, $password); 348b5284271SAndreas Gohr } 349b5284271SAndreas Gohr } 350b5284271SAndreas Gohr 351b5284271SAndreas Gohr return $ok; 352b5284271SAndreas Gohr } 353b5284271SAndreas Gohr 354b5284271SAndreas Gohr 355b5284271SAndreas Gohr /** 356b5284271SAndreas Gohr * @deprecated use plugin.usermanager.deleteUser instead 357b5284271SAndreas Gohr */ 358b5284271SAndreas Gohr public function legacyDeleteUsers($usernames) 359b5284271SAndreas Gohr { 360b5284271SAndreas Gohr if (!auth_isadmin()) { 361b5284271SAndreas Gohr throw new AccessDeniedException('Only admins are allowed to delete users', 114); 362b5284271SAndreas Gohr } 363b5284271SAndreas Gohr /** @var AuthPlugin $auth */ 364b5284271SAndreas Gohr global $auth; 365b5284271SAndreas Gohr return (bool)$auth->triggerUserMod('delete', [$usernames]); 366b5284271SAndreas Gohr } 367b5284271SAndreas Gohr 368b5284271SAndreas Gohr /** 369b5284271SAndreas Gohr * @deprecated use core.saveMedia instead 370b5284271SAndreas Gohr */ 371b5284271SAndreas Gohr public function legacyPutAttachment($id, $file, $params = []) 372b5284271SAndreas Gohr { 373*15357ce4SAndreas Gohr $ok = $this->saveMedia($id, base64_encode($file), $params['ow'] ?? false); 374b5284271SAndreas Gohr if ($ok === true) { 375b5284271SAndreas Gohr return cleanID($id); 376b5284271SAndreas Gohr } else { 377b5284271SAndreas Gohr return $ok; 378b5284271SAndreas Gohr } 379b5284271SAndreas Gohr } 380b5284271SAndreas Gohr 381b5284271SAndreas Gohr /** 382b5284271SAndreas Gohr * @deprecated use core.deleteMedia instead 383b5284271SAndreas Gohr */ 384b5284271SAndreas Gohr public function legacyDeleteAttachment($id) 385b5284271SAndreas Gohr { 386b5284271SAndreas Gohr $ok = $this->deleteMedia($id); 387b5284271SAndreas Gohr if ($ok === true) { 388b5284271SAndreas Gohr return 0; 389b5284271SAndreas Gohr } else { 390b5284271SAndreas Gohr return $ok; 391b5284271SAndreas Gohr } 392b5284271SAndreas Gohr } 393b5284271SAndreas Gohr 394b5284271SAndreas Gohr /** 395b5284271SAndreas Gohr * @deprecated use core.aclCheck instead 396b5284271SAndreas Gohr */ 397b5284271SAndreas Gohr public function legacyAclCheck($id, $user = null, $groups = null) 398b5284271SAndreas Gohr { 399b5284271SAndreas Gohr return $this->aclCheck($id, (string)$user, (string)$groups); 400b5284271SAndreas Gohr } 401b5284271SAndreas Gohr 402b5284271SAndreas Gohr /** 403b5284271SAndreas Gohr * @deprecated use core.listLinks instead 404b5284271SAndreas Gohr */ 405b5284271SAndreas Gohr public function legacyListLinks($id) 406b5284271SAndreas Gohr { 407b5284271SAndreas Gohr $links = $this->getPageLinks($id); 408b5284271SAndreas Gohr $result = []; 409b5284271SAndreas Gohr foreach ($links as $link) { 410b5284271SAndreas Gohr $result[] = [ 411b5284271SAndreas Gohr 'type' => $link['type'], 412b5284271SAndreas Gohr 'page' => $link['page'], 413b5284271SAndreas Gohr 'href' => $link['href'], 414b5284271SAndreas Gohr ]; 415b5284271SAndreas Gohr } 416b5284271SAndreas Gohr return $result; 417b5284271SAndreas Gohr } 418b5284271SAndreas Gohr 419b5284271SAndreas Gohr /** 420b5284271SAndreas Gohr * @deprecated use core.getRecentChanges instead 421b5284271SAndreas Gohr */ 422b5284271SAndreas Gohr public function legacyGetRecentChanges($timestamp) 423b5284271SAndreas Gohr { 424b5284271SAndreas Gohr $recents = $this->getRecentPageChanges($timestamp); 425b5284271SAndreas Gohr $result = []; 426b5284271SAndreas Gohr foreach ($recents as $recent) { 427b5284271SAndreas Gohr $result[] = [ 428b5284271SAndreas Gohr 'name' => $recent->id, 429b5284271SAndreas Gohr 'lastModified' => $this->toDate($recent->revision), 430b5284271SAndreas Gohr 'author' => $recent->author, 431b5284271SAndreas Gohr 'version' => $recent->revision, 432b5284271SAndreas Gohr 'perms' => auth_quickaclcheck($recent->id), 433b5284271SAndreas Gohr 'size' => @filesize(wikiFN($recent->id)), 434b5284271SAndreas Gohr ]; 435b5284271SAndreas Gohr } 436b5284271SAndreas Gohr return $result; 437b5284271SAndreas Gohr } 438b5284271SAndreas Gohr 439b5284271SAndreas Gohr /** 440b5284271SAndreas Gohr * @deprecated use core.getRecentMediaChanges instead 441b5284271SAndreas Gohr */ 442b5284271SAndreas Gohr public function legacyGetRecentMediaChanges($timestamp) 443b5284271SAndreas Gohr { 444b5284271SAndreas Gohr $recents = $this->getRecentMediaChanges($timestamp); 445b5284271SAndreas Gohr $result = []; 446b5284271SAndreas Gohr foreach ($recents as $recent) { 447b5284271SAndreas Gohr $result[] = [ 448b5284271SAndreas Gohr 'name' => $recent->id, 449b5284271SAndreas Gohr 'lastModified' => $this->toDate($recent->revision), 450b5284271SAndreas Gohr 'author' => $recent->author, 451b5284271SAndreas Gohr 'version' => $recent->revision, 452b5284271SAndreas Gohr 'perms' => auth_quickaclcheck($recent->id), 453b5284271SAndreas Gohr 'size' => @filesize(mediaFN($recent->id)), 454b5284271SAndreas Gohr ]; 455b5284271SAndreas Gohr } 456b5284271SAndreas Gohr return $result; 457b5284271SAndreas Gohr } 458b5284271SAndreas Gohr 459b5284271SAndreas Gohr /** 460b5284271SAndreas Gohr * @deprecated use core.getPageHistory instead 461b5284271SAndreas Gohr */ 462b5284271SAndreas Gohr public function legacyGetPageVersions($id, $first = 0) 463b5284271SAndreas Gohr { 464b5284271SAndreas Gohr $revisions = $this->getPageHistory($id, $first); 465b5284271SAndreas Gohr $result = []; 466b5284271SAndreas Gohr 467b5284271SAndreas Gohr foreach ($revisions as $revision) { 468b5284271SAndreas Gohr $result[] = [ 469b5284271SAndreas Gohr 'user' => $revision->author, 470b5284271SAndreas Gohr 'ip' => $revision->ip, 471b5284271SAndreas Gohr 'type' => $revision->type, 472b5284271SAndreas Gohr 'sum' => $revision->summary, 473b5284271SAndreas Gohr 'modified' => $this->toDate($revision->revision), 474b5284271SAndreas Gohr 'version' => $revision->revision, 475b5284271SAndreas Gohr ]; 476b5284271SAndreas Gohr } 477b5284271SAndreas Gohr return $result; 478b5284271SAndreas Gohr } 479b5284271SAndreas Gohr 480b5284271SAndreas Gohr /** 481b5284271SAndreas Gohr * @deprecated Wiki RPC spec is no longer supported 482b5284271SAndreas Gohr */ 483b5284271SAndreas Gohr public function legacyGetRPCVersionSupported() 484b5284271SAndreas Gohr { 485b5284271SAndreas Gohr return 2; 486b5284271SAndreas Gohr } 487b5284271SAndreas Gohr 488b5284271SAndreas Gohr /** 489b5284271SAndreas Gohr * @deprecated use core.lockPages and core.unlockPages instead 490b5284271SAndreas Gohr */ 491b5284271SAndreas Gohr public function legacySetLocks($set) 492b5284271SAndreas Gohr { 493b5284271SAndreas Gohr $locked = $this->lockPages($set['lock']); 494b5284271SAndreas Gohr $lockfail = array_diff($set['lock'], $locked); 495b5284271SAndreas Gohr 496b5284271SAndreas Gohr $unlocked = $this->unlockPages($set['unlock']); 497b5284271SAndreas Gohr $unlockfail = array_diff($set['unlock'], $unlocked); 498b5284271SAndreas Gohr 499b5284271SAndreas Gohr return [ 500b5284271SAndreas Gohr 'locked' => $locked, 501b5284271SAndreas Gohr 'lockfail' => $lockfail, 502b5284271SAndreas Gohr 'unlocked' => $unlocked, 503b5284271SAndreas Gohr 'unlockfail' => $unlockfail 504b5284271SAndreas Gohr ]; 505b5284271SAndreas Gohr } 506b5284271SAndreas Gohr 507b5284271SAndreas Gohr /** 508b5284271SAndreas Gohr * @deprecated use core.getAPIVersion instead 509b5284271SAndreas Gohr */ 510b5284271SAndreas Gohr public function legacyGetXMLRPCAPIVersion() 511b5284271SAndreas Gohr { 512b5284271SAndreas Gohr return $this->getAPIVersion(); 513b5284271SAndreas Gohr } 514b5284271SAndreas Gohr 515b5284271SAndreas Gohr /** 516b5284271SAndreas Gohr * @deprecated use core.login instead 517b5284271SAndreas Gohr */ 518b5284271SAndreas Gohr public function legacyLogin($user, $pass) 519b5284271SAndreas Gohr { 520b5284271SAndreas Gohr return parent::login($user, $pass); 521b5284271SAndreas Gohr } 522b5284271SAndreas Gohr 523b5284271SAndreas Gohr /** 524b5284271SAndreas Gohr * @deprecated use core.logoff instead 525b5284271SAndreas Gohr */ 526b5284271SAndreas Gohr public function legacyLogoff() 527b5284271SAndreas Gohr { 528b5284271SAndreas Gohr return parent::logoff(); 529b5284271SAndreas Gohr } 530b5284271SAndreas Gohr} 531