/**
  * Gets the path to the PHP file that contains the class for this object
  *
  * @return string
  */
 public function getFilePath()
 {
     if ($this->getDecorator()) {
         //search if Decorator exists already
         $subdir = $this->recursive_file_exists("{$this->key}Decorator.php", SilverSmith::get_project_dir() . '/code/');
         return SilverSmith::get_project_dir() . "/code/{$subdir}{$this->key}Decorator.php";
     }
     $subdir = $this->recursive_file_exists($this->key . '.php', SilverSmith::get_project_dir() . '/code/');
     return SilverSmith::get_project_dir() . "/code/{$subdir}{$this->key}.php";
 }
Example #2
0
     if ($conn->connect_error) {
         $err = $conn->connect_error;
         say("\nCould not connect to MySQL Database.", "on_red", "white");
         say("This is often due to an issue with MAMP.");
         say("You can run 'silversmith fix-mamp' resolve this issue.");
         $answer = ask("Press any key to show the error output...");
         say("Connection error: {$conn->connect_error}");
     }
 }
 DB::connect($databaseConfig);
 say("done");
 $project_dir = isset($PARAMS['module']) ? $PARAMS['module'] : project();
 SilverSmith::set_project_dir($project_dir);
 if ($action != "init") {
     $yml_file = isset($PARAMS['file']) ? $PARAMS['file'] : "_project.yml";
     $yml_path = SilverSmith::get_project_dir() . "/{$yml_file}";
     if (!file_exists($yml_path)) {
         fail("File {$yml_path} does not exist. Use 'silversmith init' to create it.");
     }
     state("Bootstrapping SilverSmith...");
     SilverSmith::set_yaml_path($yml_path);
     SilverSmithProject::load($yml_path);
     SilverSmith::load_field_manifest();
     SilverSmith::load_class_manifest();
     SilverSmith::load_interface_manifest();
     // Check for an upgrade every hour
     $time = time();
     $stamp = @file_get_contents($script_dir . "/upgrade");
     if (!$stamp) {
         $stamp = $time;
     }