@EXT\Route("/update/{file}/form", name="update_file_form", options = {"expose" = true})

@EXT\Template()
173260
public function updateFileFormAction(File $file)
    {
        $collection = new ResourceCollection(array($file->getResourceNode()));
        $this->checkAccess('EDIT', $collection);
        $form = $this->get('form.factory')->create(new UpdateFileType(), new File());

        return array(
            'form' => $form->createView(),
            'resourceType' => 'file',
            'file' => $file,
            '_resource' => $file
        );
    }
962635
private function buildEditForm()
    {
        $form = '';
        foreach ($this->fields as $field) {
            $title = addslashes($field->label);
            $label = $field->title;
            if (in_array($field->validation,
                    $this->starred) && $field->type != 'password' && $field->type != 'file' && $field->type != 'photo'
            ) {
                $title .= '*';
            }
            if ($field->type == 'relationship') {
                $label = $field->relationship_name . '_id';
            }
            if ($field->type == 'checkbox') {
                $field->default = '$' . $this->model . '->' . $label . ' == 1';
            }
            $temp = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Templates' . DIRECTORY_SEPARATOR . 'fields' . DIRECTORY_SEPARATOR . $field->type);
            $temp = str_replace([
                'old(\'$LABEL$\')',
                '$LABEL$',
                '$TITLE$',
                '$VALUE$',
                '$STATE$',
                '$SELECT$',
                '$TEXTEDITOR$',
                '$HELPER$',
                '$WIDTH$',
                '$HEIGHT$',
            ], [
                'old(\'$LABEL$\',$' . $this->resource . '->' . $label . ')',
                $label,
                $title,
                $field->type != 'radio' ?
                    $field->value != '' ? ', "' . $field->value . '"' : ''
                    : "'$field->value'",
                $field->default,
                '$' . $field->relationship_name,
                $field->texteditor == 1 ? ' ckeditor' : '',
                $this->helper($field->helper),
                $field->dimension_w,
                $field->dimension_h,
            ], $temp);
            $form .= $temp;
        }
        $this->formFieldsEdit = $form;
    }
605821
protected function doFormAction ()
  {
//    if (count ($_POST) == 0 && count ($_FILES) == 0)
//      throw new FileException(FileException::FILE_TOO_BIG, ini_get ('upload_max_filesize'));
    $this->getActionAndParam ($action, $param);
    $class = new ReflectionObject ($this);
    try {
      $method = $class->getMethod ('action_' . $action);
    }
    catch (ReflectionException $e) {
      throw new FlashMessageException('Class <b>' . $class->getName () . "</b> can't handle action <b>$action</b>.",
        FlashType::ERROR);
    }
    return $method->invoke ($this, $param);
  }
758485
public function onUpdate() {
    
    if (file_exists($this->savedTimestampPath)) {
      $readTimestamp = file_get_contents($this->savedTimestampPath);
      if ($readTimestamp != $this->savedTimestamp) {
        foreach ($this->clients as $sendto) {
          $sendto->send($readTimestamp);
        }
        $this->savedTimestamp = $readTimestamp;
      }
    }
    
  }
500812
function update($route) {
        $route->pattern = $this->parser->trimPath($route->pattern);
        return parent::update($route);
    }
1262709
private function _setContentFromFile() {
		
		// empty original template content
		$this->setContent('');
		
		// check for template file and load it
		if ($filename = $this->getTemplate()) {
			if (file_exists($filename)) {
				$content = trim(file_get_contents($this->_filename));
				$this->setContent($content);
			}
		}
	}
586706
private function publish($template)
    {
        if (! file_exists(app_path('Http' . DIRECTORY_SEPARATOR . 'Requests'))) {
            mkdir(app_path('Http' . DIRECTORY_SEPARATOR . 'Requests'), 0777, true);
        }
        file_put_contents(app_path('Http' . DIRECTORY_SEPARATOR . 'Requests' . DIRECTORY_SEPARATOR . 'Create' . $this->fileName),
            $template[0]);
        file_put_contents(app_path('Http' . DIRECTORY_SEPARATOR . 'Requests' . DIRECTORY_SEPARATOR . 'Update' . $this->fileName),
            $template[1]);
    }
792724
function onQuickFormEvent($event, $arg, &$caller)
    {
        switch ($event) {
            case 'updateValue':
                if ($caller->getAttribute('method') == 'get') {
                    return self::raiseError('Cannot add a file upload field to a GET method form');
                }
                $this->_value = $this->_findValue();
                $caller->updateAttributes(array('enctype' => 'multipart/form-data'));
                $caller->setMaxFileSize();
                break;
            case 'addElement':
                $this->onQuickFormEvent('createElement', $arg, $caller);
                return $this->onQuickFormEvent('updateValue', null, $caller);
                break;
            case 'createElement':
                static::__construct($arg[0], $arg[1], $arg[2], $arg[3], $arg[4]);
                break;
        }
        return true;
    }
1038151
protected function updateDB($files, $update_updated = true) {
        $module = \jacmoe\mdpages\Module::getInstance();
        $repo = $this->getFlywheelRepo();

        $filename_pattern = '/\.md$/';

        $metaParser = new Meta;

        $file_action = '';

        foreach ($files as $file) {
            if (!preg_match($filename_pattern, $file)) {
                continue;
            }

            $file_field = substr($file, strlen(Yii::getAlias('@pages')));

            if(!file_exists($file)) {
                // if the post exists, delete it
                $page = $repo->query()->where('file', '==', $file_field)->execute();
                $result = $page->first();
                if($result != null) {
                    echo "File $result->file exists - deleting ..\n";

                    $this->deleteCachekeys($module, $result->url);

                    $repo->delete($result);
                }
                $file_action = 'deleted';
                $this->stdout($file_field . ' was ' . $file_action . "\n");
                continue;
            }

            $metatags = array();
            $metatags = $metaParser->parse(file_get_contents($file));

            $url = $file_field;
            $url = ltrim($url, '/');
            $raw_url = pathinfo($url);
            $url = $raw_url['filename'];
            if($url == 'README') continue;
            if($raw_url['dirname'] != '.') {
                $url = $raw_url['dirname'] . '/' . $url;
            }

            $values = array();

            foreach($metatags as $key => $value) {
                $values[$key] = $value;
            }
            $values['url'] = $url;
            $values['file'] = $file_field;

            list($contributors, $dates) = $this->committersFromFile(ltrim($values['file'],'/'), $module);

            $updated_date = 0;
            $created_date = 0;
            if(isset($values['datetime'])) {
                // work-around for existing page collections
                // where the dates in the commits does not apply
                $updated_date = $values['datetime'];
                $created_date = $values['datetime'];
            } else {
                if(count($dates) === 1) {
                    $updated_date = $dates[0];
                    $created_date = $dates[0];
                } else {
                    $updated_date = end($dates);
                    $created_date = reset($dates);
                }
            }

            $file_action = 'created';

            // if the post exists, delete it
            $page = $repo->query()->where('file', '==', $values['file'])->execute();
            $result = $page->first();
            if($result != null) {
                $file_action = 'updated';
                $values['created'] = $result->created;
                $values['updated'] = $update_updated ? $updated_date : $result->updated;

                $this->deleteCachekeys($module, $result->url);

                $repo->delete($result);
            }

            if($file_action == 'created') {
                $values['created'] = $created_date;
                $values['updated'] = $created_date;
            }

            if($module->generate_contributor_data) {
                $values['contributors'] = $contributors;
            }

            $page = new Document($values);
            $repo->store($page);

            $this->stdout($file_field . ' was ' . $file_action . "\n");

        }

    }
1157114
public function update($id, FileRequest $request)
    {
        $files = $this->repository->find($id);

        if (empty($files)) {
            Cms::notification('File not found', 'warning');

            return redirect(route($this->routeBase.'.files.index'));
        }

        $files = $this->repository->update($files, $request->all());

        Cms::notification('File updated successfully.', 'success');

        return Redirect::back();
    }
1363914
def form(alias_name, user, host, options)
      retuned = "\n"
      retuned += "Host #{alias_name}\n"
      retuned += "  HostName #{host}\n"
      retuned += "  User #{user}\n"

      options.file_content.each_pair do |key, value|
        retuned += value
      end
      retuned

    end
946822
public function updateRoutesFile($name)
    {
        $name = strtolower(Pluralizer::plural($name));

        $routesPath = app_path() . '/routes.php';
        $routesContent = $this->file->get($routesPath);

        $resourceRoute = "Route::resource('" . $name . "', '" . ucwords($name) . "Controller');";

        if ( ! strpos($routesContent, $resourceRoute))
        {
            return $this->file->append($routesPath, "\n\n".$resourceRoute);
        }

        return false;
    }
149700
public function updateAction()
    {
        $request = $this->getRequest();
        if ($request->isPost()) {
            if ($this->getRequest()->getQuery('controller')) {
                $redirect = '?controller=' . $this->getRequest()->getQuery('controller')
                    . '&action=' . $this->getRequest()->getQuery('action')
                    . '&locale=' . $this->getRequest()->getQuery('locale');
            } else {
                $redirect = '';
            }

             $data = array_merge(
                 $request->getPost()->toArray(),
                 $request->getFiles()->toArray()
             );
   
            foreach ($data['translate'] as $locale => $values) {
                $return  = $this->getTranslateService()->writeFile($locale, $values);

                if ($return === false) {
                    $this->flashMessenger()->addMessage('The translate has not been updated');

                    return $this->redirect()->toUrl($this->url()->fromRoute('admin/playgroundtranslate') . $redirect);
                }

                $return = $this->getTranslateService()->activeTranslate($locale);

                if ($return === false) {
                    $this->flashMessenger()->addMessage('The translate has not been updated');

                    return $this->redirect()->toUrl($this->url()->fromRoute('admin/playgroundtranslate') . $redirect);
                }
                $this->flashMessenger()->addMessage('The translate has been updated');
            }
            sleep(2);

            return $this->redirect()->toUrl($this->url()->fromRoute('admin/playgroundtranslate') . $redirect);
        }

        return $this->redirect()->toUrl($this->url()->fromRoute('admin/playgroundtranslate') . $redirect);
    }
1281021
public function update()
        {
                $ok = true;

                // perform updates...
                $ok = $this->updateFile(self::FILENAME_RULES);

                if ($ok)
                        $ok = $this->updateFile(self::FILENAME_CONVERTER);

                return $ok;
        }
1161830
public function updateFile($request, $match)
    {
        // Get data
        $resource = Pluf_Shortcuts_GetObjectOr404('Tenant_Resource', $match['modelId']);
        // Do action
        if (array_key_exists('file', $request->FILES)) {
            $extra = array(
                'model' => $resource
            );
            $form = new Tenant_Form_ResourceUpdate(array_merge($request->REQUEST, $request->FILES), $extra);
            $resource = $form->save();
            return $resource;
        } else {
            $myfile = fopen($resource->getAbsloutPath(), "w") or die("Unable to open file!");
            $entityBody = file_get_contents('php://input', 'r');
            fwrite($myfile, $entityBody);
            fclose($myfile);
            $resource->update();
        }
        return $resource;
    }
460216
public function buildView(FormView $view, FormInterface $form, array $options)
    {
        $data = $form->getParent()->getData();
        if ($options['currentFile'] || $data instanceof AbstractUploadable) {
            try {
                $currentFile = isset($options['currentFile']) && $options['currentFile'] ? $options['currentFile'] : $data->getWebPath($form->getName());
            } catch (\Exception $e) {
                // In some cases, getWebPath might throw an exception
                $currentFile = null;
            }

            if ($currentFile) {
                $view->vars['currentFile'] = $currentFile;
                $view->vars['currentFileUrl'] = isset($options['currentFileUrl']) && $options['currentFileUrl'] ? $options['currentFileUrl'] : false;
                $view->vars['showDelete'] = $options['showDelete'] && is_string($options['showDelete']) ? $options['showDelete'] : false;
            }
        }
    }
743303
public function updateAction()
    {
        // Check current user authorization
        if (null !== $response = $this->checkAuth(AdminResources::MODULE, Team::getModuleCode(),
                AccessManager::UPDATE)
        ) {
            return $response;
        }

        // Load object if exist
        if (null !== $object = $this->getExistingObject()) {
            // Hydrate the form abd pass it to the parser
            $changeForm = $this->hydrateObjectForm($object);

            // Pass it to the parser
            $this->getParserContext()->addForm($changeForm);
        }

        // Render the edition template.
        return $this->getEditRenderTemplate();
    }