diff --git a/include/class.ticket.php b/include/class.ticket.php
index 7c6194a62df667911ec99ca6a11f7cd8b40fd1db..9ba4d7760c063ade60ea6d528f4a95c8004affd4 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -3173,7 +3173,7 @@ implements RestrictedAccess, Threadable, Searchable {
     function save($refetch=false) {
         if ($this->dirty) {
             $this->updated = SqlFunction::NOW();
-            if (isset($this->dirty['status_id']))
+            if (isset($this->dirty['status_id']) && PHP_SAPI !== 'cli')
                 // Refetch the queue counts
                 SavedQueue::clearCounts();
         }