* To change this template use File | Settings | File Templates.
*/
public class MigrationsCondition implements Condition {
@Override
public boolean value(Object o) {
YiiStormProjectComponent component = YiiStormProjectComponent.getInstance((Project) o);
Notifications.Bus.register("yiicnotfound", NotificationDisplayType.BALLOON);
if (component.getBooleanProp("useYiiMigrations")) {
boolean phpOk = CommonHelper.phpVersionCheck();
if (component.getProp("yiicFile").length() < 1) {
Notifications.Bus.notify(new Notification("yiistormMigration",
"YiiStorm migrations",
"Yiic not selected ",
NotificationType.WARNING));
return false;
}
if (component.getProp("yiicFile") != null && phpOk && Yiic.yiicIsRunnable(component.getProp("yiicFile"))) {
return true;
} else {
Notifications.Bus.notify(new Notification("yiistormMigration",
"YiiStorm migrations",
phpOk ? "Yiic file not configured." : "Can't run php. Check your system configuration. ",