Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[FrameworkBundle] Allow user to specify folder for flock#26923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:masterfromMaksSlesarenko:patch-1
Sep 4, 2018

Conversation

@MaksSlesarenko
Copy link
Contributor

@MaksSlesarenkoMaksSlesarenko commentedApr 13, 2018
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
LicenseMIT
Doc PR

In case multiple applications running on same server allow user to specify folder for flock
example:

framework:    lock:` 'flock://var/flock' # var/flock will be provided as path to flock constructor   lock: 'flock:///var/flock' # /var/flock will be provided as path to flock constructor   lock: flock # works as usual, null is provided to constructor and system temp folder is used

@nicolas-grekasnicolas-grekas changed the titleAllow user to specify folder for flock[FrameworkBundle] Allow user to specify folder for flockApr 14, 2018
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

looks like a good idea to me
ping@jderusse for 2nd review
what about adding some tests?

foreach ($resourceStoresas$storeDsn) {
$storeDsn =$container->resolveEnvPlaceholders($storeDsn,null,$usedEnvs);
switch (true) {
case'flock' ===$storeDsn:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think we should keep this case, and add a new one after

switch (true) {
case'flock' ===$storeDsn:
$storeDefinition =newReference('lock.store.flock');
case0 ===strpos($storeDsn,'flock'):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

case 0 === strpos($storeDsn, 'flock://'): + substr instead of str_replace below


if ($isMatched) {
$storeDefinition =newDefinition(FlockStore::class);
$storeDefinition->setPublic(false);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

not required anymore, this is the default since 4.0

$storeDefinition =newDefinition(FlockStore::class);
$storeDefinition->setPublic(false);
$storeDefinition->setArguments(array($flockPath));
$container->setDefinition($storeDefinitionId ='lock.flock.store.'.$container->hash($storeDsn),$storeDefinition);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

anticipating for#26921, the service name should start with a dot

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'd suggest this:

$storeDefinitionId ='.lock.flock.store.'.$container->hash($storeDsn);$container->register($storeDefinitionId, FlockStore::class)->addArgument($flockPath);

Copy link
Member

@jderussejderusse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Great idea, I like the use of DSN for such purpose.

Nothing to add to@nicolas-grekas 's comments :)

@MaksSlesarenko
Copy link
ContributorAuthor

updated pr.
I don't mind adding couple tests, but I'm not seeing any for lock component in framework bundle to begin with

case'flock' ===$storeDsn:
$storeDefinition =newReference('lock.store.flock');
break;
case0 ===strpos($storeDsn,'flock'):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

'flock://'

case0 ===strpos($storeDsn,'flock'):
$flockPath =substr($storeDsn,8);

$storeDefinitionId ='lock.flock.store.'.$container->hash($storeDsn);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

'.lock.flock.store.'.$container->hash($storeDsn); as per@nicolas-grekas 's comment

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can someone enlighten me about purpose of the starting dot?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@MaksSlesarenko
Copy link
ContributorAuthor

up

@nicolas-grekas
Copy link
Member

see fabbot failure :)

$flockPath =substr($storeDsn,8);

$storeDefinitionId ='.lock.flock.store.'.$container->hash($storeDsn);
$container->register($storeDefinitionId, FlockStore::class)->addArgument($flockPath);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

missinguse statement for theFlockStore class

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

done

@fabpotfabpot modified the milestones:4.1,nextApr 22, 2018
@MaksSlesarenko
Copy link
ContributorAuthor

MaksSlesarenko commentedMay 8, 2018
edited
Loading

Is there anything else I forgot to fix?

$storeDefinitionId ='.lock.flock.store.'.$container->hash($storeDsn);
$container->register($storeDefinitionId, FlockStore::class)->addArgument($flockPath);

$storeDefinition =newReference($storeDefinitionId);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Do we need the reference? I mean if I don't miss anything, we do not reuse it anyway, so something like this should work the same:

$flockPath =substr($storeDsn,8);$storeDefinitionId ='.lock.flock.store.'.$container->hash($storeDsn);$storeDefinition =$container->register($storeDefinitionId, FlockStore::class)->addArgument($flockPath);

Copy link
ContributorAuthor

@MaksSlesarenkoMaksSlesarenkoMay 11, 2018
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Same can be said for both 'flock' and 'semaphore' cases. But I'm not sure that this PR is correct place for such refactoring. Besides '$storeDefinitions' already contains 'Reference' objects so it would be not cool to add strings or non-Reference type

@MaksSlesarenko
Copy link
ContributorAuthor

up

@fabpot
Copy link
Member

Thank you@MaksSlesarenko.

@fabpotfabpot merged commit244d762 intosymfony:masterSep 4, 2018
fabpot added a commit that referenced this pull requestSep 4, 2018
…ck (MaksSlesarenko)This PR was merged into the 4.2-dev branch.Discussion----------[FrameworkBundle] Allow user to specify folder for flock| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| License       | MIT| Doc PR        |In case multiple applications running on same server allow user to specify folder for flockexample:```framework:   lock:` 'flock://var/flock' # var/flock will be provided as path to flock constructor   lock: 'flock:///var/flock' # /var/flock will be provided as path to flock constructor   lock: flock # works as usual, null is provided to constructor and system temp folder is used```Commits-------244d762 added ability to specify folder for flock
@nicolas-grekasnicolas-grekas modified the milestones:next,4.2Nov 1, 2018
This was referencedNov 3, 2018
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull requestSep 26, 2019
…rence (HypeMC)This PR was submitted for the 4.2 branch but it was squashed and merged into the 4.3 branch instead (closes#11466).Discussion----------Add flock:// option to framework lock configuration referenceFixes#9779 & extends#11465 .Documents the `flock://` option which was added withsymfony/symfony#26923 .**NOTE 1**: The xml configuration doesn't currently work, seesymfony/symfony#31197**NOTE 2**: This PR has all the changes that#11465 has plus some symfony 4.2 specific additions, so#11465 should probably be merged first.Commits-------d9125fd Add flock:// option to framework lock configuration reference
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@jderussejderussejderusse approved these changes

@xabbuhxabbuhxabbuh requested changes

@nicolas-grekasnicolas-grekasnicolas-grekas requested changes

@fabpotfabpotfabpot approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.2

Development

Successfully merging this pull request may close these issues.

6 participants

@MaksSlesarenko@nicolas-grekas@fabpot@jderusse@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp