protected function flightcheck()
{
if (empty(self::$_pluginSettings)) {
throw new Minimee_InfoException(Craft::t('Minimee is not installed.'));
}
if (!$this->settings->enabled) {
throw new Minimee_InfoException(Craft::t('Minimee has been disabled via settings.'));
}
if (!$this->settings->validate()) {
$exceptionErrors = '';
foreach ($this->settings->getErrors() as $error) {
$exceptionErrors .= implode('. ', $error);
}
throw new Minimee_WarningException(Craft::t('Minimee has detected invalid plugin settings: ') . $exceptionErrors);
}
if ($this->settings->useResourceCache()) {
IOHelper::ensureFolderExists($this->makePathToStorageFolder());
} else {
if (!IOHelper::folderExists($this->settings->cachePath)) {
throw new Minimee_WarningException(Craft::t('Minimee\'s Cache Folder does not exist: ' . $this->settings->cachePath));
}
if (!IOHelper::isWritable($this->settings->cachePath)) {
throw new Minimee_WarningException(Craft::t('Minimee\'s Cache Folder is not writable: ' . $this->settings->cachePath));
}
}
if (!$this->assets) {
throw new Minimee_InfoException(Craft::t('Minimee has no assets to operate upon.'));
}
if (!$this->type) {
throw new Minimee_WarningException(Craft::t('Minimee has no value for `type`.'));
}
return $this;
}