Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P7615
flow opt-out debug
Active
Public
Actions
Authored by
kostajh
on Oct 2 2018, 2:28 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F26276439: flow opt-out debug
Oct 2 2018, 2:28 PM
2018-10-02 14:28:50 (UTC 0)
Subscribers
None
<?php
use
Flow\Container
;
use
User
;
function
checkFlowTalkPageManagerPermissions
(
$action
,
Title
$talkpage
,
User
$user
)
{
$errors
=
[
'talkpage'
=>
$talkpage
->
getUserPermissionsErrors
(
'edit'
,
$user
,
'secure'
)
];
$subpages
=
$talkpage
->
getSubpages
();
/** @var Title $subpage */
foreach
(
$subpages
as
$subpage
)
{
$errors
[
'subpages'
][]
=
$subpage
->
getUserPermissionsErrors
(
'edit'
,
$user
,
'secure'
);
}
if
(
count
(
$errors
)
)
{
print
"Found errors
\n
"
;
var_dump
(
$errors
);
return
false
;
}
print
"No errors
\n
"
;
return
true
;
}
$user_id
=
0
;
// get from DB
$user
=
User
::
newFromId
(
$user_id
);
/** @var \Flow\TalkpageManager $occupationController */
$occupationController
=
Container
::
get
(
'occupation_controller'
);
/** @var \Flow\Import\OptInController $optInController */
$optInController
=
Container
::
get
(
'controller.opt_in'
);
// Check permissions.
checkFlowTalkPageManagerPermissions
(
'disable'
,
$user
->
getTalkPage
(),
$occupationController
->
getTalkpageManager
()
);
$optInController
->
initiateChange
(
'disable'
,
$user
->
getTalkPage
(),
$user
);
Event Timeline
kostajh
created this paste.
Oct 2 2018, 2:28 PM
2018-10-02 14:28:50 (UTC 0)
kostajh
mentioned this in
T70526: Flow: InvalidDataException "Flow workflow is for different page" from WorkflowLoaderFactory.php
.
Log In to Comment