Skip to content

Commit 25f009f

Browse files
authored
Remove the deprecated isCli function (#44611)
Thank you @laoneo, one more off the list.
1 parent f9360e5 commit 25f009f

File tree

5 files changed

+2
-73
lines changed

5 files changed

+2
-73
lines changed

installation/src/Application/CliInstallationApplication.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -311,21 +311,4 @@ public function isClient($identifier)
311311
{
312312
return 'cli_installation' === $identifier;
313313
}
314-
315-
/**
316-
* Flag if the application instance is a CLI or web based application.
317-
*
318-
* Helper function, you should use the native PHP functions to detect if it is a CLI application.
319-
*
320-
* @return boolean
321-
*
322-
* @since 4.3.0
323-
*
324-
* @deprecated 4.3 will be removed in 5.0
325-
* Use $app->isClient('cli_installation') instead
326-
*/
327-
public function isCli()
328-
{
329-
return $this->isClient('cli_installation');
330-
}
331314
}

libraries/src/Application/CMSApplication.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,23 +1288,6 @@ public function checkToken($method = 'post')
12881288
return $session::checkToken($method);
12891289
}
12901290

1291-
/**
1292-
* Flag if the application instance is a CLI or web based application.
1293-
*
1294-
* Helper function, you should use the native PHP functions to detect if it is a CLI application.
1295-
*
1296-
* @return boolean
1297-
*
1298-
* @since 4.0.0
1299-
*
1300-
* @deprecated 4.0 will be removed in 6.0
1301-
* Will be removed without replacements
1302-
*/
1303-
public function isCli()
1304-
{
1305-
return false;
1306-
}
1307-
13081291
/**
13091292
* No longer used
13101293
*

libraries/src/Application/CMSApplicationInterface.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -124,20 +124,6 @@ public function getMessageQueue();
124124
*/
125125
public function isClient($identifier);
126126

127-
/**
128-
* Flag if the application instance is a CLI or web based application.
129-
*
130-
* Helper function, you should use the native PHP functions to detect if it is a CLI application.
131-
*
132-
* @return boolean
133-
*
134-
* @since 4.0.0
135-
*
136-
* @deprecated 4.0 will be removed in 6.0
137-
* Will be removed without replacement. CLI will be handled by the joomla/console package instead
138-
*/
139-
public function isCli();
140-
141127
/**
142128
* Get the application identity.
143129
*

libraries/src/Application/ConsoleApplication.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -387,23 +387,6 @@ public function isClient($identifier)
387387
return $this->getName() === $identifier;
388388
}
389389

390-
/**
391-
* Flag if the application instance is a CLI or web based application.
392-
*
393-
* Helper function, you should use the native PHP functions to detect if it is a CLI application.
394-
*
395-
* @return boolean
396-
*
397-
* @since 4.0.0
398-
*
399-
* @deprecated 4.0 will be removed in 6.0
400-
* Will be removed without replacement. CLI will be handled by the joomla/console package instead
401-
*/
402-
public function isCli()
403-
{
404-
return true;
405-
}
406-
407390
/**
408391
* Sets the session for the application to use, if required.
409392
*

libraries/src/User/User.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace Joomla\CMS\User;
1111

1212
use Joomla\CMS\Access\Access;
13+
use Joomla\CMS\Application\ConsoleApplication;
1314
use Joomla\CMS\Event\User\AfterDeleteEvent;
1415
use Joomla\CMS\Event\User\AfterSaveEvent;
1516
use Joomla\CMS\Event\User\BeforeDeleteEvent;
@@ -743,15 +744,8 @@ public function save($updateOnly = false)
743744
$iAmRehashingSuperadmin = true;
744745
}
745746

746-
// Check if we are using a CLI application
747-
$isCli = false;
748-
749-
if (Factory::getApplication()->isCli()) {
750-
$isCli = true;
751-
}
752-
753747
// We are only worried about edits to this account if I am not a Super Admin.
754-
if ($iAmSuperAdmin != true && $iAmRehashingSuperadmin != true && $isCli != true) {
748+
if ($iAmSuperAdmin != true && $iAmRehashingSuperadmin != true && !Factory::getApplication() instanceof ConsoleApplication) {
755749
// I am not a Super Admin, and this one is, so fail.
756750
if (!$isNew && Access::check($this->id, 'core.admin')) {
757751
throw new \RuntimeException('User not Super Administrator');

0 commit comments

Comments
 (0)