I had a math teacher that used to lock misbehaving kids into her store room too. I say store room as she kept the class books and stuff in there, but it was more like the department's utility room. Never really thought any thing off it at the time, but I guess it could have ended bad for the kids too.
Usually what would happen is a kid would kick off in the class, and be locked in there until they calmed down.
We'd see the store room light flashing off and on like crazy and we'd all laugh at it before getting back on with our work.
The kid in the store room would usually turn of the networking, I think we were still using token ring back then! so they could have simply just uncoupled a machine or something.
The next time we came to use the computer's they just wouldn't work on the network. The teachers didn't know how to fix it, and because the IT staff would spend most all day trying to fix and our lesson was only 2 hours, we often we simply forwent the use of them.
The same kids usually messed with the department's heating too, teachers would not notice until radiators were burning hot and because they were the old cast iron ones they'd take forever to cool down. If you were unlucky enough to have to sit next to them you'd be dripping buckets by the end of the day.
Not only that but they'd normally come away with several books stuffed down their pants after being locked in the store room too.
It was not really a punishment for them, more like extra way to have fun for being idiots. It's a shame they didn't get locked like the OP post.
I agree they shouldn't have been left there for that long, but the school needs another way to discipline kids. School was stupid with its rules back when I was in school some 20 years ago now, I can only imagine that how teacher's have to cope now. No excuse for letting the kid pee themselves though