DDC-2509: Add CLI detection for the APC check on Console cache commands #3152

Closed
opened 2026-01-22 14:13:52 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Jun 17, 2013).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user jcm:

There is some instanceof checks on the \Doctrine\ORM\Tools\Console\Command\ClearCache* commands to detect if APC is being used, they were introduced here: 8efae0b232

I would like to know if it's possible to add a CLI check too, something like:
if ($cacheDriver instanceof Cache\ApcCache && PHP_SAPI === 'cli' )

Yeah, I know that those are CLI commands, and so the check looks like unecessary, however, in the particular case that I found it's necessary, I'm running the commands under an WebUI:
Before the modification:
!http://i.imgur.com/8a2iVl7.jpg!

After:
!http://i.imgur.com/LTN1aDa.jpg!

Originally created by @doctrinebot on GitHub (Jun 17, 2013). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user jcm: There is some instanceof checks on the \Doctrine\ORM\Tools\Console\Command\ClearCache* commands to detect if APC is being used, they were introduced here: https://github.com/doctrine/doctrine2/commit/8efae0b232210b27200f2709e7fcb24c7f02c5de I would like to know if it's possible to add a CLI check too, something like: `if ($cacheDriver instanceof Cache\ApcCache && PHP_SAPI === 'cli' )` Yeah, I know that those are CLI commands, and so the check looks like unecessary, however, in the particular case that I found it's necessary, I'm running the commands under an WebUI: Before the modification: !http://i.imgur.com/8a2iVl7.jpg! After: !http://i.imgur.com/LTN1aDa.jpg!
admin added the Improvement label 2026-01-22 14:13:52 +01:00
admin closed this issue 2026-01-22 14:13:52 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jun 17, 2013):

Comment created by @ocramius:

CLI commands are not meant to be used in WEB environment (at least not the Symfony CLI ones). You should probably replicate that logic instead.

@doctrinebot commented on GitHub (Jun 17, 2013): Comment created by @ocramius: CLI commands are not meant to be used in WEB environment (at least not the Symfony CLI ones). You should probably replicate that logic instead.
Author
Owner

@doctrinebot commented on GitHub (Oct 30, 2015):

Issue was closed with resolution "Won't Fix"

@doctrinebot commented on GitHub (Oct 30, 2015): Issue was closed with resolution "Won't Fix"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3152