Any contract made by the commissioner of correction or warden of any prison, or by any officer or any other authority whatsoever, of any prison, reformatory, penitentiary or other correctional institution of this state, in violation of, or contrary to, the provisions of this article, shall be null and void. It shall be the duty of any such officer or authorities to furnish to the attorney-general, upon demand therefor, a true copy, if in writing, and if not, in substance, of any contract made by such officer or authorities, relating in any way to the system of labor adopted, or to the employment of prisoners in any of said prisons, reformatories, penitentiaries or other correctional institutions. Whenever the attorney-general shall be satisfied that any contract made as aforesaid is contrary to or in violation of this article, or that any of the officers or authorities aforesaid have entered into or are engaged in any contract or arrangement for the labor of prisoners, or relating to the system adopted or continued in said institutions, which contract or arrangement is contrary to or in violation of law as aforesaid, if he shall be of the opinion that the facts require such action, he is hereby authorized to bring an action in the supreme court in the name of the people of the state of New York, in any county which he may select, for the purpose of testing the validity of any contract or arrangement made by any of the officers herein named, relating in any way to the system of labor adopted, or the employment of prisoners in any of said prisons, reformatories, penitentiaries or other correctional institutions, or to determine the validity of any act or thing done by any officer herein mentioned, which act or thing shall be alleged to have been in violation of this article. Any party to such contract, agreement or arrangement as aforesaid, or interested in the determination of such action, shall be made defendant, and pending the trial or hearing of the facts alleged, or of any issue made as aforesaid, the court shall, upon notice of the attorney-general, and upon a petition duly verified showing the making of any contract or arrangement in violation of the provisions of this article, or the doing of any act or thing by any of the parties defendant, in violation of this article, grant an injunction order, restraining the parties named in said order from the further prosecution of the business complained of, or from the further performance of the contract or arrangement claimed to have been entered into as aforesaid, and to restrain and enjoin such officer from the further continuance of any act alleged to be in violation of this article. And any disobedience of such injunction order shall be punishable as provided by article nineteen of the judiciary law. And upon any trial had, judgment shall follow the findings of fact made by the court or jury, as in other cases, and with costs, in the discretion of the court.