/** * * Creates a symlink in "docroot/public" for a given class. * * @param string $class The class name. * * @return void * */ protected function _link($class) { // array of class-name parts $arr = explode('_', $class); // the last part of the class name where to put the symlink $tgt = array_pop($arr); // make the rest of the array into a subdirectory path $sub = implode('/', $arr); // where is the source (original) directory located, relatively? $k = count($arr); $src = ""; for ($i = 0; $i < $k; $i++) { $src .= "../"; } $src .= "../../include/{$sub}/{$tgt}/Public"; // need the system root $system = Solar::$system; // make sure we have a place to make the symlink $dir = "docroot/public/{$sub}"; if (!Solar_Dir::exists("{$system}/{$dir}")) { $this->_out(" Making public directory {$dir} ... "); Solar_Dir::mkdir("{$system}/{$dir}", 0755, true); $this->_outln("done."); } // make the symlink $this->_out(" Making public symlink for {$class} ... "); try { Solar_Symlink::make($src, $tgt, $dir); $this->_outln('done.'); } catch (Exception $e) { $this->_out($e->getMessage()); $this->_outln(' ... failed.'); } }