W
W
WildZero2016-11-24 17:32:41
Capistrano
WildZero, 2016-11-24 17:32:41

How to organize code delivery with CI?

Good afternoon.
I'm setting up jenkins to deploy a php application, and I ran into a problem with delivering code to all web servers, I couldn't bind capistrano 3 because it refuses to work with local files, only with the repository (and everything has already been taken from the turnip, and everything we need has been collected ).
And accordingly the question arose, how to deliver the code to the servers?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anton Natarov, 2017-03-10
@HanDroid

1) Why are functions and variables with normal naming, and the class as "Otschit"?) No f - call everything by its proper name.
2) Model of the form - taken out in a separate class. Field validation in form models. And the view is also in a separate file.
3) The use of super global variables POST GET is not allowed, the data must be thrown / injected into the class, and not used internally. As a rule, they are used in controllers within MVC.
4) Translations and inscriptions are also placed in a separate i18n file. Imagine the situation, they called you tomorrow and said that you need to do it in German. Do you climb into every class to fix it all? And if there are 100 classes?)
5) The Save method can be turned into an update at the same time. If Id is added to the method, then you update the record, if not, then create it.
6) I would also add exceptions, but that's already it, everyone does where it is convenient for him.
Why is there a setter on the boss, but add on the director Although this is also a setter?)

Z
zorca, 2017-03-10
@zorca

What does this method do?

public function replaceBoss($name)
{
if(!empty($boss))
{
$this->boss = $boss;
}
}

D
D3lphi, 2017-03-10
@D3lphi

public function setBoss($name)
  {
    $this->boss = $name;
  }

In this case, this setter method is of no practical use, it does not check anything, does not return an object, so that you can make method calls in the $obj->a()->b() chain; In this case, it is more appropriate to use the property directly.
You don't need to write constructs like this:
if (...)
{
  //
}

We write like this:
if (...) {
  //
}

This does not apply to classes, methods and functions (in which the parenthesis must be written on a separate line). All this, by the way, is written in PSR. Choose the method naming style so that it is the same throughout the entire code, otherwise you have camelCase in one place and under_scope in another.
if(file_put_contents($filename, $content))
    {
      return 'Отчет сохранен';
    }
    else
    {
      return 'Ошибка сохранения';
    }

No need to return a string! Return true or false. And remember: if something is wrong, throw an exception!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question