public function perform_action() { $input = FWS_Props::get()->input(); $user = FWS_Props::get()->user(); $folderstr = $input->get_var('folders', 'post', FWS_Input::STRING); $exclstr = $input->get_var('exclude', 'post', FWS_Input::STRING); $files = array(); $folders = FWS_Array_Utils::advanced_explode("\n", $folderstr); $excl = FWS_Array_Utils::advanced_explode("\n", $exclstr); FWS_Array_Utils::trim($excl); // determine files to scan foreach ($folders as $folder) { $folder = trim($folder); if (is_file($folder)) { $files[] = $folder; } else { foreach (FWS_FileUtils::get_list($folder, true, true) as $item) { if (!$this->is_excluded($item, $excl)) { $files[] = $item; } } } } // clear position, just to be sure $storage = new FWS_Progress_Storage_Session('ptypescan_'); $storage->clear(); // store in session $user->set_session_data('typescan_files', $files); // store in project $project = FWS_Props::get()->project(); $project->set_type_folders($folderstr); $project->set_type_exclude($exclstr); PC_DAO::get_projects()->update($project); // clear previous data in the db PC_DAO::get_classes()->delete_by_project($project->get_id()); PC_DAO::get_functions()->delete_by_project($project->get_id()); PC_DAO::get_constants()->delete_by_project($project->get_id()); PC_DAO::get_classfields()->delete_by_project($project->get_id()); PC_DAO::get_errors()->delete_by_type(PC_Obj_Error::get_types_of(PC_Obj_Error::R_TYPESCANNER), $project->get_id()); $this->set_redirect(true, PC_URL::get_submod_url(0, 'cliscan')); $this->set_show_status_page(false); $this->set_action_performed(true); return ''; }
public function perform_action() { $input = FWS_Props::get()->input(); $id = $input->get_var('id', 'get', FWS_Input::STRING); if (!FWS_Helper::is_integer($id) || $id <= 0) { return 'The id is invalid'; } PC_DAO::get_calls()->delete_by_project($id); PC_DAO::get_classes()->delete_by_project($id); PC_DAO::get_classfields()->delete_by_project($id); PC_DAO::get_constants()->delete_by_project($id); PC_DAO::get_errors()->delete_by_project($id); PC_DAO::get_functions()->delete_by_project($id); PC_DAO::get_vars()->delete_by_project($id); $this->set_redirect(false); $this->set_success_msg('The project has been cleaned successfully'); $this->set_show_status_page(true); $this->set_action_performed(true); return ''; }
public function perform_action() { $input = FWS_Props::get()->input(); $idstr = $input->get_var('ids', 'get', FWS_Input::STRING); $ids = FWS_Array_Utils::advanced_explode(',', $idstr); if (!FWS_Array_Utils::is_numeric($ids)) { return 'Got an invalid id-string'; } PC_DAO::get_projects()->delete($ids); foreach ($ids as $id) { PC_DAO::get_calls()->delete_by_project($id); PC_DAO::get_classes()->delete_by_project($id); PC_DAO::get_classfields()->delete_by_project($id); PC_DAO::get_constants()->delete_by_project($id); PC_DAO::get_errors()->delete_by_project($id); PC_DAO::get_functions()->delete_by_project($id); PC_DAO::get_vars()->delete_by_project($id); } $this->set_redirect(false); $this->set_show_status_page(false); $this->set_action_performed(true); return ''; }
/** * Loads the fields from db, if not already done */ private function load_fields() { if ($this->fields === null) { $this->fields = array(); foreach (PC_DAO::get_classfields()->get_all(array($this->id), $this->pid) as $field) { $this->fields[strtolower($field->get_name())] = $field; } } }
public function create_field($field, $classid) { return PC_DAO::get_classfields()->create($field, $classid); }
/** * Builds the classes from given rows completely, i.e. without lazy-loading * * @param array $rows the rows * @param int $pid the project-id * @return array the class-objects */ private function build_complete_classes($rows, $pid) { $classes = array(); foreach ($rows as $row) { $classes[$row['id']] = $this->build_class($row, $pid, false); } $cids = array_keys($classes); foreach (PC_DAO::get_constants()->get_list($cids, '', '', $pid) as $const) { $classes[$const->get_class()]->add_constant($const); } foreach (PC_DAO::get_classfields()->get_all($cids, $pid) as $field) { $classes[$field->get_class()]->add_field($field); } foreach (PC_DAO::get_functions()->get_list($cids, 0, 0, '', '', $pid) as $method) { $classes[$method->get_class()]->add_method($method); } return $classes; }