public function install_client_files() { if (!isset($this->installdefs['clientfiles']) || !is_array($this->installdefs['clientfiles'])) { return; } // clientfiles contains five identical lists of files for each of the // activities relationships, this condenses them so we only copy once. $copyList = array(); foreach ($this->installdefs['clientfiles'] as $outer) { foreach ($outer as $to => $from) { $copyList[$to] = $from; } } foreach ($copyList as $to => $from) { $contents = file_get_contents($from); SugarAutoloader::ensureDir(dirname($to)); SugarAutoloader::put($to, $contents, false); } SugarAutoloader::saveMap(); }
protected function saveClientFiles($basepath, $installDefPrefix, $relationshipName, $moduleClientFileList) { $installDefs = array(); foreach ($moduleClientFileList as $moduleName => $clientFileList) { mkdir_recursive("{$basepath}/{$moduleName}/clients"); foreach ($clientFileList as $fileName => $contents) { $from = "{$basepath}/{$moduleName}/" . $fileName; $to = "modules/{$moduleName}/" . $fileName; $installDefs[$moduleName][$to] = $from; SugarAutoloader::ensureDir(dirname($from)); sugar_file_put_contents($from, $contents); } } return $installDefs; }