Check if there are any changes

@return boolean
547855
public function isEmptyChanges()
    {
        foreach ($this->originals as $name => $orignial) {
            if ($this->hasChange($name)) {
                return false;
            }
        }

        return true;
    }
1062722
public function checkExistence()
    {
        if (empty($this->primaryKey)) {
            return false;
        }

        return static::find()->pk($this->primaryKey)->count() > 0;
    }
1218812
public function isDirty() : bool
    {
        foreach ($this->__state as $prop => $val) {
            if ($this->isModified($prop)) {
                return true;
            }
        }
        return false;
    }
249148
public function hasChanged()
    {
        foreach ($this->modelData as $property => $value) {
            if ($this->hasPropertyChanged($property)) {
                return true;
            }
        }

        // In case model data has been manually unset
        $manuallyUnsetProperties = array_diff_key($this->changeSnapshotData, $this->modelData);
        foreach ($manuallyUnsetProperties as $property => $value) {
            // If it wasn't null before, that's a change
            if ($value !== null) {
                return true;
            }
        }

        return false;
    }
28002
protected function checkUpdates()
    {
        // Avoid checking more than once in this process.
        if (self::$checkedUpdates) {
            return;
        }
        self::$checkedUpdates = true;

        // Check that the Phar extension is available.
        if (!extension_loaded('Phar')) {
            return;
        }

        // Get the filename of the Phar, or stop if this instance of the CLI is
        // not a Phar.
        $pharFilename = \Phar::running(false);
        if (!$pharFilename) {
            return;
        }

        // Check if the file is writable.
        if (!is_writable($pharFilename)) {
            return;
        }

        // Check if updates are configured.
        $config = $this->config();
        if (!$config->get('updates.check')) {
            return;
        }

        // Determine an embargo time, after which updates can be checked.
        $timestamp = time();
        $embargoTime = $timestamp - $config->get('updates.check_interval');

        // Stop if updates were last checked after the embargo time.
        /** @var \Platformsh\Cli\Service\State $state */
        $state = $this->getService('state');
        if ($state->get('updates.last_checked') > $embargoTime) {
            return;
        }

        // Stop if the Phar was updated after the embargo time.
        if (filemtime($pharFilename) > $embargoTime) {
            return;
        }

        // Ensure classes are auto-loaded if they may be needed after the
        // update.
        /** @var \Platformsh\Cli\Service\Shell $shell */
        $shell = $this->getService('shell');
        /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */
        $questionHelper = $this->getService('question_helper');
        $currentVersion = $this->config()->get('application.version');

        /** @var \Platformsh\Cli\Service\SelfUpdater $cliUpdater */
        $cliUpdater = $this->getService('self_updater');
        $cliUpdater->setAllowMajor(true);
        $cliUpdater->setTimeout(5);

        try {
            $newVersion = $cliUpdater->update(null, $currentVersion);
        } catch (\RuntimeException $e) {
            if (strpos($e->getMessage(), 'Failed to download') !== false) {
                $this->stdErr->writeln('<error>' . $e->getMessage() . '</error>');
                $newVersion = false;
            } else {
                throw $e;
            }
        }

        $state->set('updates.last_checked', $timestamp);

        // If the update was successful, and it's not a major version change,
        // then prompt the user to continue after updating.
        if ($newVersion !== false) {
            $exitCode = 0;
            list($currentMajorVersion,) = explode('.', $currentVersion, 2);
            list($newMajorVersion,) = explode('.', $newVersion, 2);
            if ($newMajorVersion === $currentMajorVersion
                && isset($this->input)
                && $this->input instanceof ArgvInput
                && is_executable($pharFilename)) {
                $originalCommand = $this->input->__toString();
                $questionText = "\n"
                    . 'Original command: <info>' . $originalCommand . '</info>'
                    . "\n\n" . 'Continue?';
                if ($questionHelper->confirm($questionText)) {
                    $this->stdErr->writeln('');
                    $exitCode = $shell->executeSimple(escapeshellarg($pharFilename) . ' ' . $originalCommand);
                }
            }
            exit($exitCode);
        }

        $this->stdErr->writeln('');
    }
1279288
def _has_changed(self, initial, data):
        """"""
        if data == initial:
            return False
        return bool(initial) != bool(data)
813124
public function hasOnUpdate()
    {
        $database = $this->getTable()->getDatabase();
        if($database instanceof Database &&
               $this->onUpdate === $database->getPlatform()->getDefaultFKOnUpdateBehavior()) {
          return false;
        }

        return ($this->onUpdate !== self::NONE);
    }
1217562
public function isRulesUpdated()
        {
                if ($this->getCurrentFileHash(self::FILENAME_RULES) ==
                        $this->getLocalFileHash(self::FILENAME_RULES)) {
                        return true;
                } else {
                        return false;
                }
        }
804212
public function was_changed( $attributes = null ) {
		return $this->has_changes(
			$this->get_changes(), is_array( $attributes ) ? $attributes : func_get_args()
		);
	}
1371327
public boolean isChanged() {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "isChanged");
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "isChanged",  changed);
    return changed;
  }
831433
public function checkHas() {
        /* @var $model Record */
        $model = get_called_class();
        $model = $model::get($this->getPk());
        if ($model) {
            $this->isUpdate(true);
            return true;
        }
        return false;
    }
1210800
public function anyTrue()
    {
        if (is_array($this->result)) {
            foreach ($this->result as $item) {
                if ($item === true) {
                    return true;
                }
            }
        } else {
            return $this->result === true;
        }
        return false;
    }
1335332
public function checkForUpdates()
    {
        Piwik::checkUserHasSomeAdminAccess();
        $this->checkTokenInUrl();

        // perform check (but only once every 10s)
        UpdateCheck::check($force = false, UpdateCheck::UI_CLICK_CHECK_INTERVAL);

        $view = new View('@CoreHome/checkForUpdates');
        $this->setGeneralVariablesView($view);
        return $view->render();
    }
141544
public function check()
    {

        $config = $this->getConfig();

        if (isset($config['ext'])) {
            $this->setExt($config['ext']);
        }

        if (isset($config['folder'])) {

            $folder = $config['folder'];
            $this->setFolder($folder);


            if(!$this->getFileSystem()->exists($folder))
            {
                $this->getFileSystem()->createDir($folder);
                chmod($folder, 0777);
            }
        }else{

            return false;
        }

        // we have do something else

        if (function_exists('gzcompress') && function_exists('gzuncompress')) {
            return true;
        }
    }
1043323
public function detectChanges()
    {
        if ($this->changedFiles === null || $this->changedPaths === null) {
            $this->loadDetectedDirectoriesAndFiles();
            $changesDetected = false;
            $this->changedPaths = $this->changedFiles = [];
            $this->changedFiles = $this->detectChangedFiles($this->monitoredFiles);

            foreach ($this->monitoredDirectories as $path => $filenamePattern) {
                $changesDetected = $this->detectChangesOnPath($path, $filenamePattern) ? true : $changesDetected;
            }

            if ($changesDetected) {
                $this->saveDetectedDirectoriesAndFiles();
            }
            $this->directoriesAndFiles = null;
        }

        $changedFileCount = count($this->changedFiles);
        $changedPathCount = count($this->changedPaths);

        if ($changedFileCount > 0) {
            $this->emitFilesHaveChanged($this->identifier, $this->changedFiles);
        }
        if ($changedPathCount > 0) {
            $this->emitDirectoriesHaveChanged($this->identifier, $this->changedPaths);
        }
        if ($changedFileCount > 0 || $changedPathCount) {
            $this->logger->info(sprintf('File Monitor "%s" detected %s changed files and %s changed directories.', $this->identifier, $changedFileCount, $changedPathCount), LogEnvironment::fromMethodName(__METHOD__));
        }
    }
750435
public function isChanged(): bool
    {
        $this->changedFiles = [];
        do{
            $readResult = \inotify_read($this->handler);
            if(false === $readResult)
            {
                return $result ?? false;
            }
            foreach($readResult as $item)
            {
                $key = array_search($item['wd'], $this->paths);
                if(false === $key)
                {
                    continue;
                }
                $filePath = File::path($key, $item['name']);
                $filePathIsDir = is_dir($filePath);
                if(!$filePathIsDir)
                {
                    $this->changedFiles[] = $filePath;
                }
                if(Bit::has($item['mask'], IN_CREATE) || Bit::has($item['mask'], IN_MOVED_TO))
                {
                    if($filePathIsDir && !$this->isExclude($filePath))
                    {
                        $this->paths[$filePath] = \inotify_add_watch($this->handler, $filePath, $this->mask);
                    }
                }
            }
            $result = isset($readResult[0]);
        }while(true);
    }
759941
public function hasPendingChangesets()
    {
        $qb = $this->createQueryBuilder('ac')
            ->select('count(ac)')
            ->where('ac.status = :status')
            ->setParameter('status', AclChangeset::STATUS_NEW);

        return $qb->getQuery()->getSingleScalarResult() != 0;
    }