mantis custom status only changing new status when set? - mantis

so I followed the tutorial here
https://www.mantisbt.org/docs/master/en-US/Admin_Guide/html/admin.customize.status.html
In my config_inc.php I have
$g_status_enum_string = '10:reported,20:development_pending,30:development_in_progress,40:qa_pending,50:qa_in_progress,60:return_to_development,70:qa_completed,80:deployed_to_production,90:closed';
and in
custom_constants_inc.php I have
define( 'REPORTED', 10 );
define( 'DEVELOPMENT_PENDING', 20 );
define( 'DEVELOPMENT_IN_PROGRESS', 30 );
define( 'QA_PENDING', 40 );
define( 'QA_IN_PROGRESS', 50 );
define( 'RETURN_TO_DEVELOPMENT', 60 );
define( 'QA_COMPLETED', 70 );
define( 'DEPLOYED_TO_PRODUCTION', 80 );
define( 'CLOSED', 90 );
When I load it a ticket I only see that "return_to_development" and "qa_completed" have changed, the rest of the string are still the old ones. And those 2 are the only NEW status codes, so I am not sure how to make the system recognize that I changed the original status codes?
Also in the workflow transitions page the new ones are listed as "#60# #70# " and the rest still have the old names. Its like its not picking up custom_constants_inc.php?
Thank you in advance.

ok I figured it out. I missed that I needed to define "$s_status_enum_string = ..." in the custom_strings_inc.php

Related

update_post_meta() not working on post update

I have this super simple code to update a JetEngine Meta data field for a CPT called "Plans" after a post update:
add_action( 'save_post_plans', 'xb_update_display_fields2', 10, 3 );
function xb_update_display_fields2( $post_id, $post, $update ){
remove_action( 'save_post_plans', 'xb_update_display_fields2', 10 );
$id = $post->ID;
$postarr = array( 'ID' => $id, 'post_content' => 'Test content update');
wp_update_post( $postarr );
update_post_meta( $id, 'lifetime-pricing', 3688);
}
I've added the "Test content update" part just as a test and it works fine after a post update but the Meta data update doesn't work when I update a post.
It does however work when I create a new post. lifetime-pricing is a numeric, I've tried with text fields and same thing.
I've tried with the save_post hook instead of the save_post_plans hook and same result.
Hopefully somebody can help me figure it out. Many thanks! :)

LCP result is totally opposite from performance API than the pagespeed insights or webpagetest

I am trying to optimise LCP for this page. I read an article on LCP optimisation where I also found a script which can help to determine which part of the LCP most time is spent on. Script:
const LCP_SUB_PARTS = [
'Time to first byte',
'Resource load delay',
'Resource load time',
'Element render delay',
];
new PerformanceObserver((list) => {
const lcpEntry = list.getEntries().at(-1);
const navEntry = performance.getEntriesByType('navigation')[0];
const lcpResEntry = performance
.getEntriesByType('resource')
.filter((e) => e.name === lcpEntry.url)[0];
// Ignore LCP entries that aren't images to reduce DevTools noise.
// Comment this line out if you want to include text entries.
if (!lcpEntry.url) return;
// Compute the start and end times of each LCP sub-part.
// WARNING! If your LCP resource is loaded cross-origin, make sure to add
// the `Timing-Allow-Origin` (TAO) header to get the most accurate results.
const ttfb = navEntry.responseStart;
const lcpRequestStart = Math.max(
ttfb,
// Prefer `requestStart` (if TOA is set), otherwise use `startTime`.
lcpResEntry ? lcpResEntry.requestStart || lcpResEntry.startTime : 0
);
const lcpResponseEnd = Math.max(
lcpRequestStart,
lcpResEntry ? lcpResEntry.responseEnd : 0
);
const lcpRenderTime = Math.max(
lcpResponseEnd,
// Prefer `renderTime` (if TOA is set), otherwise use `loadTime`.
lcpEntry ? lcpEntry.renderTime || lcpEntry.loadTime : 0
);
// Clear previous measures before making new ones.
// Note: due to a bug this does not work in Chrome DevTools.
// LCP_SUB_PARTS.forEach(performance.clearMeasures);
// Create measures for each LCP sub-part for easier
// visualization in the Chrome DevTools Performance panel.
const lcpSubPartMeasures = [
performance.measure(LCP_SUB_PARTS[0], {
start: 0,
end: ttfb,
}),
performance.measure(LCP_SUB_PARTS[1], {
start: ttfb,
end: lcpRequestStart,
}),
performance.measure(LCP_SUB_PARTS[2], {
start: lcpRequestStart,
end: lcpResponseEnd,
}),
performance.measure(LCP_SUB_PARTS[3], {
start: lcpResponseEnd,
end: lcpRenderTime,
}),
];
// Log helpful debug information to the console.
console.log('LCP value: ', lcpRenderTime);
console.log('LCP element: ', lcpEntry.element);
console.table(
lcpSubPartMeasures.map((measure) => ({
'LCP sub-part': measure.name,
'Time (ms)': measure.duration,
'% of LCP': `${
Math.round((1000 * measure.duration) / lcpRenderTime) / 10
}%`,
}))
);
}).observe({type: 'largest-contentful-paint', buffered: true});
For me, this was the result at the start in 4x CPU slowdown and Fast3G connection.
After that, since render delay was the area where I should focus on, I moved some of the scripts to the footer and also made the "deferred" scripts "async". This is the result:
We can see there is a clear improvement in LCP after the change but, when I test with lighthouse the result is different.
Before:
After:
I am in dilemma now about what step to take. Please suggest!!
I ran a trace of the URL you linked in your question, and the first thing I noticed is that your LCP resource finishes loading pretty early in the page, but it isn't able to render until a file called mirage2.min.js finishes loading.
This explains why your "Element render delay" portion of LCP is so long, and moving your scripts to the bottom of the page or seeing defer of them is not going to solve that problem. The solution is to make it so your LCP image can render without needing to wait until that JavaScript file finishes loading.
Another thing I noticed is this mirage2.min.js file is loaded from ajax.cloudflare.com, which made me think it's a "feature" offered by Cloudflare and not something you set up yourself.
Based on what I see here, I'm assuming that's true:
https://support.cloudflare.com/hc/en-us/articles/219178057
So my recommendation for you is to turn off this feature, because it's clearly not helping your LCP, as you can see in this trace:
There's one more thing you said that I think is worth clarifying:
After that, since render delay was the area where I should focus on, I moved some of the scripts to the footer and also made the "deferred" scripts "async". This is the result:
When I look at your "result" screenshot, I still see that the "element render delay" portion is still > 50%, so while you were correct when you said that "render delay was the area where I should focus on", the fact that it was still high after you made your changes (e.g. moving the scripts and using defer/async) was an indication that the changes you tried didn't fix the problem.
In this case, I believe that if you turn off the "Mirage" feature in your Cloudflare dashboard, you should see a big improvement.
Oh, one more thing, I noticed that you're using importance="high" on your image. This is old syntax that does not work anymore. You should replace that with fetchpriority="high" instead. See this post for details: https://web.dev/priority-hints/

How can I automatically download web pages for offline viewing?

I am writing a macro; but at some point i need help.
What I want is to download pages in bulk for offline viewing.
I used IDM; but the pages seem to be missing when viewing the files after downloading.
I also need to be able to set their names automatically so that I can automatically replace them with another macro; so I'm writing a macro outside of IDM or similar program.
So I wanted to download with CTRL+S + Save type: Webpage, Single File method.
I did everything; I just want it to automatically increment the record name by 1 by 1.
Sample;
document.selection.StartOfDocument();
nLines = document.GetLines();
for( y = 1; y < nLines; ++y ) {
str = document.GetLine( y );
if( str.length != 0 ) {
document.selection.OpenLink();
Sleep( 5000 );
shell.SendKeys( "^s" );
Sleep( 500 );
//////////////////////////////////////////////////////////////////
How can I add the command I want at this point?
I can get it to write the number '1'; but it has to increment by 1 each time.
How can I do this code?
//////////////////////////////////////////////////////////////////
shell.SendKeys( "~" );
Sleep( 500 );
shell.SendKeys( "%{F4}" );
Sleep( 500 );
}
document.selection.LineDown(false,1);
}
alert( "Finished Saving" );
After this command, it will write 1 for the record name.
And it will increment it by 1 each time.
URL - (The filename will be saved as 1.)
URL - (The filename will be saved as 2.)
URL - (The filename will be saved as 3.)
...
URL - (The filename will be saved as 365.)
P.S: To put it another way; When saving the connections, the registration name should be saved as the "Line Number" where that connection is located.
That way, after all the files have been downloaded, I'll be able to use my other macro to rename them with the URL they belong to.
Finally; If you know of another way to do what I want, I'd love to hear it.
Thank you in advance and have a nice day.
y is the line number. So, replace the comment lines in your sample with:
shell.SendKeys( y );

Porting Lua 5.1 thread code to 5.2

I got the following code which work great and do exactly what I want in Lua 5.1, however trying to port that to 5.2 (and the lack of LUA_GLOBALSINDEX) Im having issues... Anybody can tell me what is the equivalent of:
thread->L = lua_newthread( G );
lua_pushvalue( G, -1 );
thread->index = luaL_ref( G, LUA_REGISTRYINDEX );
lua_newtable( thread->L );
lua_newtable( thread->L );
lua_pushliteral( thread->L, "__index" );
-- Problem... no more LUA_GLOBALSINDEX, cannot find equivalent for push.
lua_pushvalue( thread->L, LUA_GLOBALSINDEX );
lua_settable( thread->L, -3 );
lua_setmetatable( thread->L, -2 );
-- Problem... no more LUA_GLOBALSINDEX, cannot find equivalent for replace.
lua_replace( thread->L, LUA_GLOBALSINDEX );
in Lua 5.2?
Tks!
You should use lua_pushglobaltable(thead->L) (or if you have to, lua_rawgeti(thread->L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS). This is explained in the accepted answer to Lua 5.2 LUA_GLOBALSINDEX Alternative.

context menu demo app not working crossrider

I am generating context menu when user selects some text and right click it. I tried implementing it, problem is even sample application is not working.
http://crossrider.com/apps/10565/ide
appAPI.contextMenu.add("key1", "Display data object", function (data) {
var sAlertText = 'pageUrl: ' + data.pageUrl + '\r\n' +
'linkUrl: ' + data.linkUrl + '\r\n' +
'selectedText:' + data.selectedText + '\r\n' +
'srcUrl:' + data.srcUrl;
alert(sAlertText);
}, ["all"]);
Only data.pageUrl is available rest of all are "undefined". I want selectedText.
Disclaimer: I work at Crossrider.
Indeed there was an issue with the contextMenu due to a change in the Chrome API.
We've fixed this and now the demo app works.
Thank you for reporting this and please feel free to let us know if you encounter any issues!
Amir

Resources