renobird Posted April 14, 2015 Posted April 14, 2015 Anyone know of a build in way to take the bitmasked status codes and convert them back to their names/labels? Some of them get converted in ProcessPageEdit I could use that as a starting point and roll my own, but was hoping there was an easier way that I'm not aware of.
horst Posted April 14, 2015 Posted April 14, 2015 Not direct, sorry. But this can be a starting point? http://php.net/manual/de/errorfunc.constants.php#109430 1
Jan Romero Posted April 14, 2015 Posted April 14, 2015 Isn’t it just this? $out = array(); foreach(Page::getStatuses() as $status=>$value) { if ($page->status & $value) $out[] = $status; } return $out; That should return an array with all statuses set for $page, right? 5
renobird Posted April 14, 2015 Author Posted April 14, 2015 Jan Romero! It is indeed as simple as that. Thank you.
ryan Posted April 14, 2015 Posted April 14, 2015 Actually it gets even simpler than that: $statusLabels = $page->status(true); $statusLabels is an array of names/labels applicable to the page. 8
renobird Posted April 14, 2015 Author Posted April 14, 2015 Wow. That is nice. I'm storing old/new as part of an activity log module. Currently I was storing the codes, easier to just store the actual labels. Thanks all!
renobird Posted April 15, 2015 Author Posted April 15, 2015 Hey Ryan, Do you mind explaining $page->status(true) a little further? Perhaps I'm a little dense today, but I'm having trouble deciphering where to find the related code in Page.php
renobird Posted April 15, 2015 Author Posted April 15, 2015 Ah, dev branch — of course. Thanks kongondo.
horst Posted April 15, 2015 Posted April 15, 2015 Ah, dev branch — of course. Is there anything else besides that? nah, only kidding 1
LostKobrakai Posted April 15, 2015 Posted April 15, 2015 Maybe the dev branch should be made the default, so we can at least use the github search xD
renobird Posted April 15, 2015 Author Posted April 15, 2015 Unfortunately I'm stuck at 2.5.3 for production sites at work — at least until early May. The current vhost clusters here only have PHP 5.3.3 available. The minimum requirement for PW is PHP 5.3.8, but 5.3.3 still works for the master branch. That's not the case with dev. New infrastructure is just about to be released with PHP 5.5+, and we'll be moving ASAP. In the meantime — I suffer.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now